You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
std::string getColor(Vegetable toGet) {
switch (toGet) {
case Vegetable::potato:
return "brown";
case Vegetable::brocolli:
return "green";
case Vegetable::carrot:
return "orange";
default:
return "unknown";
}
}
}`
I'd like to be able to simply call Vegetable::getColor(Vegetable::carrot), for example. Is there any way to add functions to the class generated by better enums?
The text was updated successfully, but these errors were encountered:
I'm trying to emulate java's ability to add a static function to an enum class but using better enums.
`namespace playground {
BETTER_ENUM(Vegetable, int,
potato,
brocolli,
carrot
)
}`
I'd like to be able to simply call
Vegetable::getColor(Vegetable::carrot)
, for example. Is there any way to add functions to the class generated by better enums?The text was updated successfully, but these errors were encountered: