开发者

How to typedef unparameterized template? [duplicate]

开发者 https://www.devze.com 2023-03-08 13:33 出处:网络
This question already has an answer here: Closed 10 years ago. Possible Duplicate: C++ template typedef Is it possible to typedef unparameterized template like below?
This question already has an answer here: Closed 10 years ago.

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);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消