Can you create an array/vector of resizable containers?
Can you create an array of templated, resizable containers? For example, would this array work?
Code:
TemplatedContainer<ExampleClass>* ptr;
ptr = new TemplatedContainer<ExampleClass>[value];
If my logic is correct, this should work initially, because it will initialize each object in the array to a specific size, but when you try to resize one of the containers it will mess up the array because the memory addresses are contiguous. Am I correct here?
If this is the case, would a vector work?
Code:
std::vector<TemplatedContainer<ExampleClass> > example;
When you resized one of the objects in the vector, would it properly resize the vector as well, even though you aren't pushing or popping any objects?