给定一个带有单个参数的模板类,我可以为特定的专业定义一个实现:
template<int N>
struct Foo {
Foo( );
};
Foo<2>::Foo( ) { //works (on MS Visual 2012, even though it's not the most correct form)
}
对于多参数模板,是否可以定义部分专业化的实现?
template <class X, int N>
struct Bar {
Bar( );
};
template <class X>
Bar<X,2>::Bar( ) { //error
}