本文介绍了如何在类定义之外的模板类中定义模板函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
给定:
template <class T>
class Foo
{
public:
template <class U>
void bar();
};
如何在类定义之外实现bar,同时仍然可以访问模板参数T和U ?
How do I implement bar outside of the class definition while still having access to both template parameters T and U?
推荐答案
IIRC:
template<class T> template <class U>
void Foo<T>::bar() { ...
这篇关于如何在类定义之外的模板类中定义模板函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!