J
Jess
Hello,
I think the two reverse_iterators are the same, except that the const_
version doesn't allow me to change the value pointed to by the
iterators. However, I have a program that works for reverse_iterator
but not const_reverse_iterator:
for(vector<int>::const_reverse_iterator i = v.rbegin(); i != v.rend();
++i)
cout << (*i) << endl;
This one fails, with error
no match for 'operator!=' in 'i != std::vector<_Tp, _Alloc>::rend()
[with _Tp = int, _Alloc = std::allocator<int>]()'
If I replace const_reverse_iterator with reverse_iterator, then
everything works fine. Is there some subtle difference between the
two iterators?
Thanks,
Jess
I think the two reverse_iterators are the same, except that the const_
version doesn't allow me to change the value pointed to by the
iterators. However, I have a program that works for reverse_iterator
but not const_reverse_iterator:
for(vector<int>::const_reverse_iterator i = v.rbegin(); i != v.rend();
++i)
cout << (*i) << endl;
This one fails, with error
no match for 'operator!=' in 'i != std::vector<_Tp, _Alloc>::rend()
[with _Tp = int, _Alloc = std::allocator<int>]()'
If I replace const_reverse_iterator with reverse_iterator, then
everything works fine. Is there some subtle difference between the
two iterators?
Thanks,
Jess