#help: I have a small #cpp #templates #question:

how to make p.general_settings accessible ?

I don't have any idea how to describe that problem better, I just not want to write that field 'general_settings' again and again. In this example I just made two specializations, in real, there are orders of magnitude more of them.

I know all specializations can derive from a 'base' where that field is defined, but I though there is a nicer way.

@Microfractal I don't think there is. You could extend from Settings<void> though if you don't want to have an explicit BaseSettings struct. Or you need a wrapper for the specializations, e.g.:

template<typename T>
struct CompoundSettings
{
Settings<void> general;
Settings<T> specialized;
};

@Microfractal Do the inheritance the other way around. Specialize the base classes for each type, then add the generic settings in a derived class template in one go.
@zweije This is what I did. I think this is better than before. It has fewer code duplication, which I like.

@Microfractal @zweije Or if the variable name does not matter, but perhaps you need class template specialization for reasons not seen in OP.

template <typename T>
struct S {
    bool general_settings = false;
    bool T_settings = false; //if var name does not matter
};