Enum class for constants or enumerators (typically from a C-API). More...
#include <eagine/enum_class.hpp>
Public Types | |
| using | value_type = T |
| The constant or enumerator value type. | |
Public Member Functions | |
| enum_class ()=default | |
| Default constructor. | |
| template<typename Classes , typename Tag , typename = std::enable_if_t<mp_contains_v<Classes, Self>>> | |
| constexpr | enum_class (enum_value< T, Classes, Tag > ev) noexcept |
| Construction from a related enum_value. | |
| template<typename Classes , typename Tag , typename = std::enable_if_t<mp_contains_v<Classes, Self>>> | |
| constexpr | enum_class (opt_enum_value< T, Classes, Tag > ev) noexcept |
| Construction from a related opt_enum_value. | |
| constexpr | enum_class (no_enum_value< T >) noexcept |
| Construction from a no_enum_value. | |
| constexpr | enum_class (const any_enum_value< LibId > &aev) noexcept |
| Construction from an any_enum_value. | |
| constexpr | enum_class (value_type value) noexcept |
| Explicit initialization from argument of value type. | |
| constexpr | operator value_type () const noexcept |
| Explicit conversion to value type. | |
Friends | |
| constexpr friend auto | operator== (enum_class a, enum_class b) noexcept |
| Equality comparison. | |
| constexpr friend auto | operator!= (enum_class a, enum_class b) noexcept |
| Nonequality comparison. | |
Enum class for constants or enumerators (typically from a C-API).
| Self | the actual derived class based on this template. |
| T | the type of the constant or enumerator value. |
| LibId | an identifier of the "library" or API that this enum belongs to. |
| Id | a type identifier of this enumeration (unique within an API). |
Instantiations of this template can be used to represent a class of enumerated values from a C-API that logically belong together. All values from that logical class can be stored in enum_class and they are typically declared as enum_value or opt_enum_value. The conversions between enum_class and enum_value do static type checking to ensure that constants from unrelated enum classes cannot be assigned.