enum.hpp is a code facility for defining enums in C++ that have associated lookup arrays from each value of the enum to the value of another type.  The facility eliminates the possibility of hard-to-find bugs resulting from the lookup array order not corresponding to the enum value order.

 

enum_ex.cpp

enum.hpp

 

Here is an older C example, along the same lines but less powerful.

 

ex1.c

gen_enum.h

pp_concat.h