ahura24 (132) Nov 16, 2011 at 1:19pm
because whenever you call begin its take a new location , exam :
cout << "BEGIN = " << &vint_vector.begin() << endl;
cout << "BEGIN = " << &vint_vector.begin() << endl;
and see your output. |
Yes thats right, I am getting different values .... why ?
cppabuser (10) Nov 16, 2011 at 1:19pm
I would think that vint_vector.begin() is a method ... therefore you are getting the address of the method within your class. So it's doing what is supposed to do, you just need to specify the first and last value more precisely.
ico |
I thought that too , but, ..... (here is my point)
cout << "BEGIN = " << &vint_vector.begin() << endl; ---> is returning a value
printf("BEGIN = %p \n\r",vint_vector.begin()); ----> is returning another value
The thing is that the one with "cout" != &vint_vector[0]
and
the one with "printf" == &vint_vector[0]
So .... if it works with printf , its
should work with "cout" , maybe thats incorrect.
I dont care about using &vint_vector[0] instead of vint_vector.begin() to work with "cout", but .... its something weird a?
Thanks a lot for all the replies by the way.
another thing, besides that the same works withs "printf" but no with "cout", is that when I do
cout << "BEGIN = " << &vint_vector.begin() << endl;
cout << "BEGIN = " << &vint_vector.begin() << endl;
I get different locations, ... so , ..... where are we pointing ????