I want to get a list, so to speak, of the nested classes of some class, which can then be used as input to the parameter pack for another class.
For example, here is the class that would contain the nested types:
class Foo
{
public:
class FirstNested
{
// ...
}
class SecondNested
{
// ...
}
}
and here is the class with the parameter pack that would use the nested types:
template <class...Ts>
class UsesFooNestedTypes
{
private:
std::variant<Ts...> _variantOfFooNestedTypes; // irrelevant, just an exmaple of what might be done with the types.
}
is there any way to do this, or something similar?
UsesFooNestedTypes<get_nested_types_of<Foo>> fooNestedTypesUser;
Edit: Upon giving it some thought, I’ve realised that this question doesn’t reflect my actual problem closely enough. So, I have created a more specific question here: Automatically get nested state classes to use in std::variant variadic parameter for state pattern