如何对未参数化的模板进行typedef
How to typedef unparameterized template?
可能重复:
C++模板typedef
有可能像下面这样对未参数化的模板进行typedef吗?
template <class Number>
typedef Pair<Number> Point<Number>;
如果是,我应该使用什么语法?谢谢
可能为时已晚。这是链接的副本。
template <typename First, typename Second, int Third>
class SomeType;
template <typename Second>
using TypedefName = SomeType<OtherType, Second, 5>;
受gcc-4.7和4.8支持。IDE可能需要手动设置标志
-std=c11
在类内部使用typedef:
#include <vector>
template <typename T>
struct container
{
typedef std::vector<T> cont;
};
int main()
{
container<int>::cont q;
q.push_back(4);
}
相关文章:
- 如何将成员函数作为回调参数传递给需要"typedef-ed"自由函数指针的函数?
- typedef名称与可变模板参数名称一致时出现GCC错误
- 如何对绑定的成员方法进行typedef,然后将该类型用作模板参数
- 有没有一种方法可以使用typedef中的参数名称
- C++:显式调用模板参数的 typedef 的析构函数
- 如何在 C++ 中将 typedef 与类初始值设定项参数一起使用?
- 指向具有 2 个参数的 WINAPI 函数的 Typedef 指针
- 如何使用函数签名的 typedef 作为 std::function 的类型参数
- 如何在 C/C++ 中将 typedef 函数作为参数传递
- 如何从对象内部的 typedef 获取模板参数类型
- C 迭代器从Typedef std :: Map作为模板参数声明
- 将"typedef char IPString[17]"作为参数传递给函数
- Swig 简单类型 typedef 参数
- 如何将方法指针声明为Typedef方法参数
- c++检查模板参数的嵌套typedef以获取其标量基类型
- 以模板类型为参数的模板的typedef
- 如何用模板参数对函数指针进行typedef
- 使用模板参数的typedef不适用于g++
- 推导 typedef'd 函数指针的模板参数
- C++:使用"typedef"定义的类作为参数进行传递