Are iterators just pointers wrapped around some classes?
The output is same .....
1 2 3 4 5 6 7 8 9
|
string p = "Hola";
printf("%d\n",p.begin());
char *k;
k = &p[0] ;
printf("%d",k);
|
Then can i assume iterators are just fancy pointers ? And , I can't cout iterators even though i can cout pointers ?
1 2 3
|
cout<<k<<nln; //valid
cout<<(int)k<<nln; //valid
cout<<s.begin()<<nln; //not valid
|
Then can i assume iterators are just fancy pointers ? |
No. Do not make guesses about hidden implementation details.
Iterators are designed to look and behave like pointers.
Chances are, though, that they are a class object and not a simple pointer.
Topic archived. No new replies allowed.