If I have the following code, which is a struct with value templates,
enum FakeEnum
{
FakeNone,
Fake1,
Fake2,
Fake3,
Fake4,
Fake5,
Fake6,
Fake7,
Fake8,
Fake9,
Fake10,
Fake11,
Fake12,
Fake13,
Fake14,
Fake15,
Fake16,
Fake17,
// ...
Fake100,
};
template<FakeEnum FE>
struct FakeStruct
{
void FakeIt();
};
template<FakeEnum FE>
void FakeStruct<FE>::FakeIt()
{
std::cout << "void FakeStruct<" << FE << ">::FakeIt()";
}
template<>
void FakeStruct<Fake12>::FakeIt()
{
std::cout << "specialized on Fake12";
}
template<>
void FakeStruct<Fake14>::FakeIt()
{
std::cout << "specialized on Fake14";
}
template<>
void FakeStruct<Fake23>::FakeIt()
{
std::cout << "specialized on Fake23";
}
...
...but what I'd really like to write is something like
template<>
void FakeStruct<Fake12 || Fake13 || Fake14 or how do I do this???>::FakeIt()
{
std::cout << "specialized on Fake12, Fake13, and Fake14";
}
Is there some kind of SFINAE-ish way to write that FakeStruct<>::FakeIt() specialization without repeating it for multiple enum values? Ideally without changing the original declaration/signature of FakeStruct?