template <typename FruitEnum>
struct FruitManager
{
FruitEnum group
};
enum class FirstFruitEnum
{
apple_fruit,
banana_fruit,
};
enum class SecondFruitEnum
{
banana_fruit,
grape_fruit,
};
int main()
{
FruitManager<FirstFruitEnum> fruit_manager;
}
I am trying to set up something that would work like
int index = static_cast<int>(fruit_manager.group::banana_fruit);
(equivalent in output to this)
int index = static_cast<int>(FirstFruitEnum::banana_fruit);
For context, the struct is able to be created with either enum class. How is this best done?
static_cast<int>(decltype(fruit_manager.group)::banana_fruit)