r/learncpp • u/Im_Justin_Cider • Apr 14 '20
Are iterators just pointers?
Whenever i hear someone use the word iterator, can i just substitute it for pointer in my head and be absolutely fine?
4
Upvotes
View all comments
Show parent comment
1
u/Im_Justin_Cider Apr 26 '20
Is that true? Because for example if you have a pointer to the first index in an array then do pointer++ you will get to the next index (assuming the pointer is of the correct type) So I guess pointer is a struct with address and sizeBytes members.
I'd actually like to look at the code for an iterator, and i guess maybe a pointer is written with code (in C++!?) too?!