If your compiler supports C ++ 11:
template <typename T>
using DynamicArray = std::vector<T>;
otherwise (C ++ 98 or later) you can use a help structure like the following
template<typename T>
struct DynamicArray
{
typedef std::vector<T> type;
};
and then use it like
DynamicArray<int>::type my_array;
Inheriting from std :: vector is a possible solution, but keep in mind that STL containers do not have a virtual destructor. i.e:.
template <typename T>
struct DynamicArray: vector<T> { ... };
int main() {
vector<int>* p = new DynamicArray<int>();
delete p;
return 0;
}