(e-mail address removed) (John) wrote in
How about "Vector"? If I put a Vector in a structure, the size of the
structure may dynamically change, right?
I assume you mean the standard C++ class "vector" (C++ is case-sensitive).
The answer is still no, but you must be precise in what you mean by size of
the structure. Do you mean the size of the overall data structure in memory
or just the size of the struct containing the vector? I assume you mean the
latter.
The reason these can be different is because the memory managed by a vector
"v" does not have to be directly contained within the variable "v". THe
variable "v" has only to have enough space to store information required
for the bookkeeping of this memory, stored elsewhere.
As a result, the memory managed by the vector is also not generally
contained wihtin the struct that has the vector as a field.
Gregg