By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,955 Members | 1,294 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,955 IT Pros & Developers. It's quick & easy.

inconsistent behaviour of const_iterator and const_reverse_iterator

P: n/a
hello,
I've had some hard time trying to understand why does this code
compile:
http://cpp.sourceforge.net/?show=10151 (*)
while this doesn't:
http://cpp.sourceforge.net/?show=10150 (**)

Any insights would be greatly appreciated.
tia,
Slawek
(*)
#include <vector>
using std::vector;

int main()
{
vector<double> vect;
for(vector<double>::const_iterator v = vect.begin(); v !=
vect.end(); v++);
}

(**)
#include <vector>
using std::vector;

int main()
{
vector<double> vect;
for(vector<double>::const_reverse_iterator v = vect.rbegin(); v !=
vect.rend(); v++);
}

Nov 22 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

Serengeti wrote:
hello,
I've had some hard time trying to understand why does this code
compile:
http://cpp.sourceforge.net/?show=10151 (*)
while this doesn't:
http://cpp.sourceforge.net/?show=10150 (**)

Any insights would be greatly appreciated.
tia,
Slawek
(*)
#include <vector>
using std::vector;

int main()
{
vector<double> vect;
for(vector<double>::const_iterator v = vect.begin(); v !=
vect.end(); v++);
}

(**)
#include <vector>
using std::vector;

int main()
{
vector<double> vect;
for(vector<double>::const_reverse_iterator v = vect.rbegin(); v !=
vect.rend(); v++);
}


This is a defect:
http://www.open-std.org/jtc1/sc22/wg...fects.html#280
Jonathan

Nov 22 '05 #2

P: n/a
Thanks.

Slawek

Nov 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.