473,394 Members | 1,737 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

inconsistent behaviour of const_iterator and const_reverse_iterator

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
2 1547

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
Thanks.

Slawek

Nov 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: john smith | last post by:
Hi, I'm a little confused as to why the following code generates and error when compiling: #include <iostream> #include <vector> #include <iterator> using namespace std; void...
2
by: Matt | last post by:
I'm new to Java but experienced with PL/SQL. I've found what appears to be strange behaviour (a bug?) when attempting to create java stored objects using the UNIX version of Oracle SQL*PLUS...
3
by: CoolPint | last post by:
If I were to design my own container and its iterators, I understand that I need to provide both "iterator" and "const_iterator" so that begin() and end() return appropriate ones depending on the...
7
by: duckfreezone | last post by:
Hi, I've got a small test program which behaves correctly (IMHO) on all compilers that I have acccess to, with the exception of the gcc on Macintosh OSX "gcc version 4.0.0 (Apple Computer, Inc....
5
by: John Harrison | last post by:
I there a reliable and generic method to convert a const_iterator to an iterator (i.e. something like const_cast). I ask because I'm writing some methods which take and return iterators. A const...
1
by: Spoon | last post by:
Hello everyone, Could someone please confirm that the following program is valid: #include <list> typedef std::list<intList; int main() { List foo; foo.push_back(1);
20
by: Jess | last post by:
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...
5
by: Abhishek Bhatt | last post by:
I need to import data programatically from spreadsheet file into database table. There are 30 such tables. User can upload multiple files at a time. For a table(which does not have any referential...
2
by: Markus Dehmann | last post by:
I want to derive from std::set, like shown below. But when I try to declare an iterator over the contained elements I get an error, see the twp uncommented lines: #include <set> template<class...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.