stdcxx-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Sebor (JIRA)" <j...@apache.org>
Subject [jira] Updated: (STDCXX-972) std::vector<bool>::iterator doesn't meet random iterator requirements
Date Mon, 23 Jun 2008 15:36:46 GMT

     [ https://issues.apache.org/jira/browse/STDCXX-972?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Martin Sebor updated STDCXX-972:
--------------------------------

    Summary: std::vector<bool>::iterator doesn't meet random iterator requirements 
(was: std::vector<bool>::iterator doesn't meets random iterator requirements)

Corrected grammar in Summary.

> std::vector<bool>::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 <vector>
> typedef std::vector<bool> 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.


Mime
View raw message