For the following struct, since v is a dynamically allocated object, how would the memory alignment work? Is the size of struct S
constant, even as the size of v goes? So does v essentially work as a pointer (or some kind of wrapper of a pointer)?
struct S {
ANY_TYPE a;
std::vector<ANY_TYPE> v;
} s;
If the answer is yes to all the above questions, then as the size of v goes, where is the memory of its members stored? Are these considered memory on heap or on stack?
Edit: I see downvotes for this question and realized I should've done more research into std::vector itself. I read this post, which made everything clear. Thanks for the answers tho!