Thanks for your explanation, though I'm still unsure whether it's the correct approach for what I want. Maybe I should provide a bit more context:
Code:
class subject;
class layout; // mainly consists of instances of `subject'
class handler {
// do something here with `subject's within `layout'
};
Now `handler' should do its default operation on instances of `subject', for example it could apply a variable to them. But in some (rare) cases the user could want to not to apply the variable to a specific `subject' or to run a special procedure on the variable before it is applied.
At this point I came up with this:
Code:
class mask;
template<typename... Masks>
class layout: public Masks... { // only support mask functions if the user wants to
std::vector<std::reference_wrapper<mask>> masks() noexcept;
};
The `handler' class could then iterate over the masks in `layout' and apply them to all `subject's it encounters. Don't know whether this would work in detail but that's the overall draft.