Template typedef for std container (without specialization)?

c++, specialization, template-specialization, templates, typedef

Solution

Yes, in C++11.

template <typename T>
using DynamicArray = std::vector<T>;

(Not that you should use this exact alias.)

Problem

Is it possible to use typedef on a std container without specializing it? Code like this works: ``` typedef std::vector<int> intVector; ``` But for this code: ``` template <typename T> typedef std::vector<T> DynamicArray<T>; ``` I get an error: template declaration of 'typedef' It is possible to do this in C++??

Original source