Instead of using
std::vector<Object> ObjectArray;
I would like it to be
MyArray<Object> ObjectArray;
with all the std::vector methods preserved. (like push_back(), reserve(), …etc)
However, using
typedef std::vector MyArray;
won’t work. Should I use template instead? How?
What you would really want is a templated typedef. Unfortunately those are not supported in the current version of C++, but they will be added in C++0x.
For now, here’s a possible workaround:
Whether or not that is better than simply using
std::vectordirectly, I’ll leave to you to decide.