相关疑难解决方法(0)

如何输入定义模板类?

typedeftemplate class怎么办?就像是:

typedef std::vector myVector;  // <--- compiler error
Run Code Online (Sandbox Code Playgroud)

我知道两种方式:

(1) #define myVector std::vector // not so good
(2) template<typename T>
    struct myVector { typedef std::vector<T> type; }; // verbose
Run Code Online (Sandbox Code Playgroud)

我们在C++ 0x中有更好的东西吗?

c++ templates typedef c++11

71
推荐指数
2
解决办法
6万
查看次数

标签 统计

c++ ×1

c++11 ×1

templates ×1

typedef ×1