This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
std::vector<T>::const_reverse_iterator
- To: libstdc++ at gcc dot gnu dot org
- Subject: std::vector<T>::const_reverse_iterator
- From: Dean Hoover <dhoover at rochester dot rr dot com>
- Date: Wed, 18 Jul 2001 13:27:37 -0400
- Reply-To: dhoover at acm dot org
I just started using gcc-3.0 and found that the
code that follows will not compile:
#include <iostream>
#include <string>
#include <vector>
int main()
{
std::vector<std::string> v;
v.push_back("aaa");
v.push_back("bbb");
v.push_back("ccc");
std::vector<std::string>::const_reverse_iterator iter;
for (iter = v.rbegin(); iter != v.rend(); ++iter)
std::cout << *iter << std::endl;
}
I get the following errors:
g++ foobar.cc -o foobar
foobar.cc: In function `int main()':
foobar.cc:13: no match for
`std::reverse_iterator<std::__normal_iterator<const
std::string*, std::vector<std::string, std::allocator<std::string> >
> >& !=
std::reverse_iterator<std::__normal_iterator<std::string*,
std::vector<std::string, std::allocator<std::string> > > >' operator
make: *** [foobar] Error 1
This problem does not occur when I change the const_reverse_iterator to
const_iterator and remove the leading 'r' from begin and end. I think
the
example with the reverse iterator should work. Am I wrong?
Dean Hoover