Chr*_*s_F 5 c++ templates constructor c++11
可以说我有以下结构.我该如何为此编写外联构造函数?
template <typename T>
struct foo
{
template <typename Bar>
foo(int n, Bar bar);
};
Run Code Online (Sandbox Code Playgroud)
您需要两个单独的模板声明:
template <typename T>
template <typename Bar>
foo<T>::foo(int n, Bar bar)
{
// ...
}
Run Code Online (Sandbox Code Playgroud)