December 2nd, 2012, 07:15 PM
Re: Vector iterators
AH HA MOMENT!
Originally Posted by Paul McKenzie
I can see now that when the vector of structs is instantiated, space for the string is not allocated "within" the struct. Just a pointer to the string is the actual member in the struct itself. The string is actually stored elsewhere in memory. So the size of the struct remains constant and the compiler knows exactly how many bytes make up the struct which is always a constant value.
Then all the compiler has to do is:
interator * jumpValue
to get to the next struct.
You're the man Paul. Thanks for helping me understand it! (Hope that's right anyway )
This technique can actually be used in programs I write in the future.
Last edited by raptor88; December 2nd, 2012 at 07:17 PM.
Click Here to Expand Forum to Full Width