Return-Path: Delivered-To: apmail-stdcxx-issues-archive@locus.apache.org Received: (qmail 96042 invoked from network); 26 Jun 2008 09:29:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Jun 2008 09:29:36 -0000 Received: (qmail 92972 invoked by uid 500); 26 Jun 2008 09:29:37 -0000 Delivered-To: apmail-stdcxx-issues-archive@stdcxx.apache.org Received: (qmail 92950 invoked by uid 500); 26 Jun 2008 09:29:37 -0000 Mailing-List: contact issues-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list issues@stdcxx.apache.org Received: (qmail 92939 invoked by uid 99); 26 Jun 2008 09:29:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Jun 2008 02:29:37 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Jun 2008 09:28:55 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 4CC9C234C150 for ; Thu, 26 Jun 2008 02:28:45 -0700 (PDT) Message-ID: <360458146.1214472525313.JavaMail.jira@brutus> Date: Thu, 26 Jun 2008 02:28:45 -0700 (PDT) From: "Farid Zaripov (JIRA)" To: issues@stdcxx.apache.org Subject: [jira] Commented: (STDCXX-972) std::vector::iterator doesn't meet random iterator requirements In-Reply-To: <1433128581.1214034466428.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/STDCXX-972?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12608354#action_12608354 ] Farid Zaripov commented on STDCXX-972: -------------------------------------- The regression test added thus: http://svn.apache.org/viewvc?rev=671835&view=rev > std::vector::iterator doesn't meet random iterator requirements > --------------------------------------------------------------------- > > Key: STDCXX-972 > URL: https://issues.apache.org/jira/browse/STDCXX-972 > Project: C++ Standard Library > Issue Type: Bug > Components: 23. Containers > Affects Versions: 4.1.2, 4.1.3, 4.1.4, 4.2.0, 4.2.1 > Environment: All > Reporter: Farid Zaripov > Assignee: Farid Zaripov > Fix For: 4.2.2 > > Original Estimate: 1h > Remaining Estimate: 1h > > The test below fails to compile. > {code:title=test.cpp} > #include > typedef std::vector VecBool; > typedef VecBool::iterator VecBoolIter; > typedef VecBool::const_iterator VecBoolCIter; > int main () > { > VecBool vb; > VecBoolIter it = vb.begin (); > VecBoolCIter cit = vb.begin (); > 5 + it; > 5 + cit; > return 0; > } > {code} > {noformat} > test.cpp(13) : error C2784: 'std::reverse_iterator<_Iterator> std::operator +(iterator_traits<_Iterator>::difference_type,const std::reverse_iterator<_Iterator> &)' : could not deduce template argument for 'const std::reverse_iterator<_Iterator> &' from 'VecBoolCIter' > include/rw/_iterator.h(274) : see declaration of 'std::operator +' > test.cpp(13) : error C2784: 'std::reverse_iterator<_Iterator> std::operator +(iterator_traits<_Iterator>::difference_type,const std::reverse_iterator<_Iterator> &)' : could not deduce template argument for 'const std::reverse_iterator<_Iterator> &' from 'VecBoolCIter' > include/rw/_iterator.h(274) : see declaration of 'std::operator +' > test.cpp(13) : error C2784: 'std::reverse_iterator<_Iterator> std::operator +(iterator_traits<_Iterator>::difference_type,const std::reverse_iterator<_Iterator> &)' : could not deduce template argument for 'const std::reverse_iterator<_Iterator> &' from 'VecBoolCIter' > include/rw/_iterator.h(274) : see declaration of 'std::operator +' > test.cpp(13) : error C2784: '__rw::__rw_debug_iter<_Container,_Iterator,_MutableIterator> std::operator +(_Cont::difference_type,const __rw::__rw_debug_iter<_Container,_Iterator,_MutableIterator> &)' : could not deduce template argument for 'const __rw::__rw_debug_iter<_Container,_Iterator,_MutableIterator> &' from 'VecBoolCIter' > include/rw/_iterbase.h(594) : see declaration of 'std::operator +' > test.cpp(13) : error C2784: '__rw::__rw_debug_iter<_Container,_Iterator,_MutableIterator> std::operator +(_Cont::difference_type,const __rw::__rw_debug_iter<_Container,_Iterator,_MutableIterator> &)' : could not deduce template argument for 'const __rw::__rw_debug_iter<_Container,_Iterator,_MutableIterator> &' from 'VecBoolCIter' > include/rw/_iterbase.h(594) : see declaration of 'std::operator +' > test.cpp(13) : error C2784: '__rw::__rw_debug_iter<_Container,_Iterator,_MutableIterator> std::operator +(_Cont::difference_type,const __rw::__rw_debug_iter<_Container,_Iterator,_MutableIterator> &)' : could not deduce template argument for 'const __rw::__rw_debug_iter<_Container,_Iterator,_MutableIterator> &' from 'VecBoolCIter' > include/rw/_iterbase.h(594) : see declaration of 'std::operator +' > test.cpp(13) : error C2677: binary '+' : no global operator found which takes type 'VecBoolCIter' (or there is no acceptable conversion) > test.cpp(14) : error C2784: 'std::reverse_iterator<_Iterator> std::operator +(iterator_traits<_Iterator>::difference_type,const std::reverse_iterator<_Iterator> &)' : could not deduce template argument for 'const std::reverse_iterator<_Iterator> &' from 'VecBoolIter' > include/rw/_iterator.h(274) : see declaration of 'std::operator +' > test.cpp(14) : error C2784: 'std::reverse_iterator<_Iterator> std::operator +(iterator_traits<_Iterator>::difference_type,const std::reverse_iterator<_Iterator> &)' : could not deduce template argument for 'const std::reverse_iterator<_Iterator> &' from 'VecBoolIter' > include/rw/_iterator.h(274) : see declaration of 'std::operator +' > test.cpp(14) : error C2784: 'std::reverse_iterator<_Iterator> std::operator +(iterator_traits<_Iterator>::difference_type,const std::reverse_iterator<_Iterator> &)' : could not deduce template argument for 'const std::reverse_iterator<_Iterator> &' from 'VecBoolIter' > include/rw/_iterator.h(274) : see declaration of 'std::operator +' > test.cpp(14) : error C2784: '__rw::__rw_debug_iter<_Container,_Iterator,_MutableIterator> std::operator +(_Cont::difference_type,const __rw::__rw_debug_iter<_Container,_Iterator,_MutableIterator> &)' : could not deduce template argument for 'const __rw::__rw_debug_iter<_Container,_Iterator,_MutableIterator> &' from 'VecBoolIter' > include/rw/_iterbase.h(594) : see declaration of 'std::operator +' > test.cpp(14) : error C2784: '__rw::__rw_debug_iter<_Container,_Iterator,_MutableIterator> std::operator +(_Cont::difference_type,const __rw::__rw_debug_iter<_Container,_Iterator,_MutableIterator> &)' : could not deduce template argument for 'const __rw::__rw_debug_iter<_Container,_Iterator,_MutableIterator> &' from 'VecBoolIter' > include/rw/_iterbase.h(594) : see declaration of 'std::operator +' > test.cpp(14) : error C2784: '__rw::__rw_debug_iter<_Container,_Iterator,_MutableIterator> std::operator +(_Cont::difference_type,const __rw::__rw_debug_iter<_Container,_Iterator,_MutableIterator> &)' : could not deduce template argument for 'const __rw::__rw_debug_iter<_Container,_Iterator,_MutableIterator> &' from 'VecBoolIter' > include/rw/_iterbase.h(594) : see declaration of 'std::operator +' > test.cpp(14) : error C2677: binary '+' : no global operator found which takes type 'VecBoolIter' (or there is no acceptable conversion) > {noformat} > The proposed fix: > {noformat} > Index: include/vector > =================================================================== > --- include/vector (revision 670160) > +++ include/vector (working copy) > @@ -956,6 +956,11 @@ > reference operator[] (difference_type __i) { > return *(*this + __i); > } > + > + friend iterator operator+ (difference_type __n, > + const iterator &__x) { > + return __x + __n; > + } > }; > > class const_iterator > @@ -1025,6 +1030,11 @@ > const_reference operator[] (difference_type __i) { > return *(*this + __i); > } > + > + friend const_iterator operator+ (difference_type __n, > + const const_iterator &__x) { > + return __x + __n; > + } > }; > > #ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC > {noformat} -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.