enum class NewType : int
{ APPLE, BANANA, ORANGE, MANGO, STRAWBERRY, CHERRY, WATERMELON }
void Foo::serialize_this(Serialize& serialize)
{
serialize.get_int(static_cast<std::underlying_type_t<NewType>>(NewType::APPLE));
serialize.get_int(static_cast<std::underlying_type_t<NewType>>(NewType::BANANA));
serialize.get_int(static_cast<std::underlying_type_t<NewType>>(NewType::MANGO));
}
Hi can you please hint me how to remove the code repetition here and
static_cast<std::underlying_type_t<NewType>>(NewType::APPLE) Shorten this expression ?