0
假设我有一个模板类,无论出于何种原因超出了这个问题的范围,有一个嵌套类声明:模板类的嵌套类定义是否属于ipp文件?
// outer.hpp
template <typename T>
class Outer
{
class X;
void foo(); // this is defined in an ipp file
};
// should this also go into the ipp file?
template <typename T>
class Outer<T>::X
{
};
我有点困惑,我应该把的X
定义。它是否属于ipp
文件以及成员函数定义,还是它在头文件中有意义?
*所有定义应在标题中* - 你的意思是所有_declarations_?如果没有,你能否详细说明,因为我认为通常的做法是将定义放入'ipp'文件中? – arman
是的,编辑,对此感到遗憾。虽然,我从来没有使用ipp文件。只需要在一个地方使用模板代码。 – Carl
好吧,那么'X'的定义呢 - 它应该保留在头文件中还是与其余定义一起进入'ipp'文件? – arman