Possible Duplicate:
C++ template typedef
Is it possible to typedef unparameterized template like below?
template <开发者_开发百科class Number>
typedef Pair<Number> Point<Number>;
If it is, what syntax should I use? Thanks.
Probably too late. This is a duplicate of link.
template <typename First, typename Second, int Third>
class SomeType;
template <typename Second>
using TypedefName = SomeType<OtherType, Second, 5>;
Supported by gcc-4.7 and 4.8. IDE probably would need to manual set flag
-std=c11
Use typedef inside class:
#include <vector>
template <typename T>
struct container
{
typedef std::vector<T> cont;
};
int main()
{
container<int>::cont q;
q.push_back(4);
}
精彩评论