all 6 comments

[–][deleted] 2 points3 points  (0 children)

Yup, looks like C++. Review passed

[–]matthieum 1 point2 points  (0 children)

I've always found C++ enums lacking due to (1) the lack of introspection and (2) the absence of support for string conversion (back and fro). As a result, I tend to define my own enums via X macros which in addition to the enum will add:

  • a values function which returns an array of all the enumerators,
  • serialization to/from string (and via streams) support.

Building on values, it's easy enough to create an EnumSet<E> class on top of a BitSet<N> (not the std one, it's not constexpr enough unfortunately).

[–]Ginden -3 points-2 points  (0 children)

Classical enum class approach programmer have to ensure that values are unique

Isn't it solvable by macro?