1

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.

Community
  • 1
  • 1
leuays
  • 53
  • 1
  • 3

2 Answers2

2

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
Community
  • 1
  • 1
aiao
  • 4,621
  • 3
  • 25
  • 47
0

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);
}
John
  • 2,295
  • 1
  • 20
  • 25