Is it possible to use a template to create classes with names and some init options given as template parameters?
As a macro, this would be straightforward:
#define make_class(NAME, INIT) \
class NAME : public Base \
{ \
NAME () : Base() \
{ \
base_init(INIT); \
} \
};
make_class(Class1, {1, 0})
make_class(Class2, {0, 1})
But this template can't work, can it?
template<typename NAME, std::vector<int> INIT>
class NAME : public Base
{
public:
NAME () : Base()
{
base_init(INIT);
}
};
And how to generate the class instances Class1, Class2, etc.?
Would one need to wrap this into a holding class and use using to shortcut the names with template parameters?