有一个模板类template <int I> Foo和它的两个特化。我怎样才能在里面定义一些东西,Foo以便它在它的所有专业中都是可见的?例如:
template <int I>
class Foo {
public:
enum class Bat
{
One = 1,
Two = 2
};
};
template <>
class Foo<1> {
void SomeFunction( Bat bat ); // Bat неопределённо.
};
template <>
class Foo<2> {
void SomeFunction( Bat bat );
};
我能提供的最简单的事情就是把它放在一个单独的基类中