Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > inconsistent behaviour of const_iterator and const_reverse_iterator

Reply
Thread Tools

inconsistent behaviour of const_iterator and const_reverse_iterator

 
 
Serengeti
Guest
Posts: n/a
 
      11-20-2005
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++);
}

 
Reply With Quote
 
 
 
 
Jonathan Mcdougall
Guest
Posts: n/a
 
      11-20-2005

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

 
Reply With Quote
 
 
 
 
Serengeti
Guest
Posts: n/a
 
      11-20-2005
Thanks.

Slawek

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
assigning reverse_iterator to const_reverse_iterator subramanian100in@yahoo.com, India C++ 1 08-16-2009 08:47 AM
compilation error with const_reverse_iterator subramanian100in@yahoo.com, India C++ 2 10-04-2007 06:40 AM
reverse_iterator and const_reverse_iterator Jess C++ 20 06-21-2007 08:14 AM
operator != for const_reverse_iterator Spoon C++ 1 03-23-2007 09:36 AM
Inconsistent behaviour Razvan Java 19 10-11-2004 04:36 PM



Advertisments