Pro*_*mer 4 c++ templates c++11
我希望有一个模板类,里面有模板方法,并且在类外定义该方法.我试着寻找答案,但找不到答案.
例如:
template<typename A> class Type {
private:
A value;
public:
template<typename B> A Method(B value) {
// some code here, it's not important for the sake of this example
}
}
Run Code Online (Sandbox Code Playgroud)
如何将方法的定义移到Method类体之外?提前致谢.
语法会是
template<typename A>
template<typename B>
A Type<A>::Method(B value)
{
// some code here, it's not important for the sake of this example
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
74 次 |
| 最近记录: |