I am working with C++14 code. I have some scoped enums in which I declare a fake last element that is utilized as size in code. For example:
enum class fruits
{
Apple = 0,
Banana,
Orange,
fruitsEnd, // this is size
};
The assumption is of course that the default enum numbering is utilized.
I was wondering either there is any clean way in C++14 to maybe create a constexp
container like std::array
instead? That would allow to use native length()
and iterate over it more easily. Then I would miss the enum names however, so maybe mix the enum class
with it somehow in a class/ template?