StormByte C++ Library 1.2.0
StormByte is a comprehensive, cross-platform C++ library aimed at easing system programming, configuration management, logging, and database handling tasks. This library provides a unified API that abstracts away the complexities and inconsistencies of different platforms (Windows, Linux).
Loading...
Searching...
No Matches
Concepts | Typedefs | Functions
Enumeration concepts

Concepts and helpers for enum / enum class types. More...

Concepts

concept  StormByte::Type::Enum
 Unscoped or scoped enumeration (enum / enum class).
 
concept  StormByte::Type::UnsignedEnum
 Enum whose underlying type is unsigned.
 
concept  StormByte::Type::ScopedEnum
 Scoped enumeration (enum class / enum struct).
 

Typedefs

template<typename E >
using StormByte::Type::UnderlyingType = std::underlying_type_t< std::remove_cv_t< E > >
 Underlying integer type of enumeration E.
 

Functions

template<typename E >
requires Enum<E>
constexpr UnderlyingType< E > StormByte::Type::ToUnderlying (E e) noexcept
 Converts an enumeration value to its underlying integer.
 

Detailed Description

Concepts and helpers for enum / enum class types.

Typedef Documentation

◆ UnderlyingType

template<typename E >
using StormByte::Type::UnderlyingType = typedef std::underlying_type_t<std::remove_cv_t<E> >

Underlying integer type of enumeration E.

Template Parameters
EEnumeration type satisfying Enum.
enum class Foo : uint16_t { A };
std::underlying_type_t< std::remove_cv_t< E > > UnderlyingType
Underlying integer type of enumeration E.
Definition enums.hxx:88

Function Documentation

◆ ToUnderlying()

template<typename E >
requires Enum<E>
constexpr UnderlyingType< E > StormByte::Type::ToUnderlying ( e)
constexprnoexcept

Converts an enumeration value to its underlying integer.

Template Parameters
EEnumeration type satisfying Enum.
Parameters
[in]eValue to convert.
Returns
Underlying integer representation of e.
enum class Foo : int { A = 3 };
auto n = Type::ToUnderlying(Foo::A); // 3
constexpr UnderlyingType< E > ToUnderlying(E e) noexcept
Converts an enumeration value to its underlying integer.
Definition enums.hxx:103