How should I typedef
a template class
? Something like:
typedef std::vector myVector; // <--- compiler error
I know of 2 ways:
(1) #define myVector std::vector // not so good
(2) template<typename T>
struct myVector { typedef std::vector<T> type; }; // verbose
Do we have anything better in C++0x ?
template class
involved. Initially, I will implement it with standard classes then, I want to move to my custom classes made. So I want that switch should be as simple as changing atypedef
. – Bullanamespace/class
bound. They are limitless. If someone want to name their variable asmyVector
it cannot be done. – Bulla