我的问题如下.这是我的方法:
template<class T>
T my_function();
Run Code Online (Sandbox Code Playgroud)
这些专业可行:
template<>
int my_function(); //my_function<int>();
template<>
float my_function(); //my_function<flot>();
...
Run Code Online (Sandbox Code Playgroud)
但这些不是:
1.
template<>
template<class T>
std::list<T> my_function(); //my_function<std::list<class T> >();
Run Code Online (Sandbox Code Playgroud)
2.
template<class T>
template<>
std::vector<T> my_function(); //my_function<std::vector<class T> >();
Run Code Online (Sandbox Code Playgroud)
我收到错误:
too many template-parameter-lists
Run Code Online (Sandbox Code Playgroud)
所以我的问题是: 如何使用模板类专门化模板?