Quote Originally Posted by Paul McKenzie View Post
It doesn't matter what the struct consists of. The sizeof(MyStruct) is the same, regardless of what the members happen to do at runtime.
This is what I'm trying to understand. How is the sizeof(MyStruct) the same for every struct when there is a variable length string in the struct? Without a variable length member in the struct it's easy to understand but with a variable length member, it's mind boggling. Especially when the "for" loop uses:

Code:
for (vector<MyStruct>::size_type i = 0;  i < myVect.size();  ++i);
how does the "size_type" know what size each variable length struct will be? Especially if structs with a variable length string are push_back'd on the end of the vector during runtime in response to user input. (Mind boggling)

(Please realize that this is just a "discussion" question. Just idle curiosity so to speak.)

Thanks for the discussion,
Raptor