我的一些基类有很多参数。现在我想指定使用哪个静态函数:
template <typename... Types>
struct SBase {
static void func() {
}
};
struct A : public SBase<int> {
};
struct B : public A, public SBase<int, double, short,
unsigned int, float, unsigned char, long, unsigned long> {
// using SBase::func; // Not possible.
// Horrible, but works.
using SBase<int, double, short,
unsigned int, float, unsigned char, long, unsigned long>::func;
};
如您所见,我需要编写两次模板参数,这会导致代码重复。
有没有办法摆脱它?