vectors and const_reverse_iterator
This is my example code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
#include <vector>
std::vector<int> v;
int main(int, char **)
{
std::vector<int>::const_reverse_iterator iter = v.rbegin();
if (iter != v.rbegin()) // or v.rend(), whatever, just problematic
{
}
}
|
Is this supposed to compile correctly?
Using g++ 4.2.4 it does.
Using
sbox-i686-linux-gcc (GCC) 3.4.4 (release) (CodeSourcery ARM 2005q3-2) |
I get :
error: no match for 'operator!=' in 'iter != std::vector<_Tp, _Alloc>::rbegin() [with _Tp = int, _Alloc = std::allocator<int>]()
|
Kind of makes const reverse iterating a non-const vector inconvenient.
Topic archived. No new replies allowed.