OGLplus  (0.59.0) a C++ wrapper for rendering APIs

eagine::enum_class< Self, T, LibId, Id > Struct Template Reference

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.
 

Detailed Description

template<typename Self, typename T, identifier_t LibId, identifier_t Id>
struct eagine::enum_class< Self, T, LibId, Id >

Enum class for constants or enumerators (typically from a C-API).

Template Parameters
Selfthe actual derived class based on this template.
Tthe type of the constant or enumerator value.
LibIdan identifier of the "library" or API that this enum belongs to.
Ida type identifier of this enumeration (unique within an API).
See also
any_enum_class
enum_value
any_enum_value
opt_enum_value
no_enum_value
is_enum_class_v
enum_class_span
enum_class_view
enum_class_array

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.


The documentation for this struct was generated from the following file:

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).