Skip to content

natanaeljr/enum_t

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

njr::enum_t

enum_t is a generic enumeration interface for C++14/17, intended for defining a standard way of capturing information about an enumeration at compile-time without using macros like other enum libraries do.

enum_t provides an interface for obtaining information about an enum type. Unlike other reflection enum libraries, enum_t does not rely on macros of any sort to define your enumeration, in fact, one of the premisses of this library is to not change the way enums are defined. What it wants is to maintain the C++ enum declaration style, and still have extended information about the enum.

Another premisse of the library is all the enum information should be available as of compile-time so there is no run-time cost when using enum_t, really!

Features

  • Enumerators' name with enum_t<E>::name().
  • The size (count) of enumerators.
  • Maximum and minimum values of the enumeration.
  • Constexpr iterable array of the enumerator sorted by value, with enum_t<E>::values
  • Implicit interchangeable convertion from enum to enum_t<E>, and vice-versa.
  • Enum traits: is_enum_valid, is_enum_contiguous, is_enum_znegative, is_enum_zpositive, is_enum_bitset.
  • Enumerator's meaning with enum_t<E>::what().

Releases

No releases published

Packages

No packages published

Languages