hoshi-lang dev
Yet another programming language
Loading...
Searching...
No Matches
magic_enum Namespace Reference

Namespaces

namespace  bitwise_operators
 
namespace  customize
 
namespace  detail
 

Classes

struct  is_scoped_enum
 
struct  is_unscoped_enum
 
struct  underlying_type
 

Typedefs

using char_type = string_view::value_type
 
template<typename T >
using Enum = detail::enum_concept< T >
 
template<typename T >
using underlying_type_t = typename underlying_type< T >::type
 
template<auto V>
using enum_constant = detail::enum_constant< V >
 

Functions

template<typename E >
constexpr auto enum_type_name () noexcept -> detail::enable_if_t< E, string_view >
 
template<typename E , detail::enum_subtype S = detail::subtype_v<E>>
constexpr auto enum_count () noexcept -> detail::enable_if_t< E, std::size_t >
 
template<typename E , detail::enum_subtype S = detail::subtype_v<E>>
constexpr auto enum_value (std::size_t index) noexcept -> detail::enable_if_t< E, std::decay_t< E > >
 
template<typename E , std::size_t I, detail::enum_subtype S = detail::subtype_v<E>>
constexpr auto enum_value () noexcept -> detail::enable_if_t< E, std::decay_t< E > >
 
template<typename E , detail::enum_subtype S = detail::subtype_v<E>>
constexpr auto enum_values () noexcept -> detail::enable_if_t< E, detail::values_t< E, S > >
 
template<typename E >
constexpr auto enum_integer (E value) noexcept -> detail::enable_if_t< E, underlying_type_t< E > >
 
template<typename E >
constexpr auto enum_underlying (E value) noexcept -> detail::enable_if_t< E, underlying_type_t< E > >
 
template<typename E , detail::enum_subtype S = detail::subtype_v<E>>
constexpr auto enum_index (E value) noexcept -> detail::enable_if_t< E, optional< std::size_t > >
 
template<auto V, detail::enum_subtype S = detail::subtype_v<std::decay_t<decltype(V)>>>
constexpr auto enum_index () noexcept -> detail::enable_if_t< decltype(V), std::size_t >
 
template<auto V>
constexpr auto enum_name () noexcept -> detail::enable_if_t< decltype(V), string_view >
 
template<typename E , detail::enum_subtype S = detail::subtype_v<E>>
constexpr auto enum_name (E value) noexcept -> detail::enable_if_t< E, string_view >
 
template<typename E , detail::enum_subtype S = detail::subtype_v<E>>
constexpr auto enum_names () noexcept -> detail::enable_if_t< E, detail::names_t< E, S > >
 
template<typename E , detail::enum_subtype S = detail::subtype_v<E>>
constexpr auto enum_entries () noexcept -> detail::enable_if_t< E, detail::entries_t< E, S > >
 
template<typename E , detail::enum_subtype S = detail::subtype_v<E>>
constexpr auto enum_cast (underlying_type_t< E > value) noexcept -> detail::enable_if_t< E, optional< std::decay_t< E > > >
 
template<typename E , detail::enum_subtype S = detail::subtype_v<E>, typename BinaryPredicate = std::equal_to<>>
constexpr auto enum_cast (string_view value, BinaryPredicate p={}) noexcept(detail::is_nothrow_invocable< BinaryPredicate >()) -> detail::enable_if_t< E, optional< std::decay_t< E > >, BinaryPredicate >
 
template<typename E , detail::enum_subtype S = detail::subtype_v<E>>
constexpr auto enum_contains (E value) noexcept -> detail::enable_if_t< E, bool >
 
template<typename E , detail::enum_subtype S = detail::subtype_v<E>>
constexpr auto enum_contains (underlying_type_t< E > value) noexcept -> detail::enable_if_t< E, bool >
 
template<typename E , detail::enum_subtype S = detail::subtype_v<E>, typename BinaryPredicate = std::equal_to<>>
constexpr auto enum_contains (string_view value, BinaryPredicate p={}) noexcept(detail::is_nothrow_invocable< BinaryPredicate >()) -> detail::enable_if_t< E, bool, BinaryPredicate >
 
template<typename E , detail::enum_subtype S = detail::subtype_v<E>>
constexpr auto enum_reflected (underlying_type_t< E > value) noexcept -> detail::enable_if_t< E, bool >
 
template<typename E , detail::enum_subtype S = detail::subtype_v<E>>
constexpr auto enum_reflected (E value) noexcept -> detail::enable_if_t< E, bool >
 

Variables

constexpr bool is_magic_enum_supported = detail::supported<void>::value
 
template<typename T >
constexpr bool is_unscoped_enum_v = is_unscoped_enum<T>::value
 
template<typename T >
constexpr bool is_scoped_enum_v = is_scoped_enum<T>::value
 
constexpr auto case_insensitive = detail::case_insensitive<>{}
 
template<bool AsFlags = true>
constexpr auto as_flags = AsFlags ? detail::enum_subtype::flags : detail::enum_subtype::common
 
template<bool AsFlags = true>
constexpr auto as_common = AsFlags ? detail::enum_subtype::common : detail::enum_subtype::flags
 

Typedef Documentation

◆ char_type

using char_type = string_view::value_type

Definition at line 149 of file magic_enum.h.

◆ Enum

template<typename T >
using Enum = detail::enum_concept<T>

Definition at line 1133 of file magic_enum.h.

◆ enum_constant

template<auto V>
using enum_constant = detail::enum_constant<V>

Definition at line 1160 of file magic_enum.h.

◆ underlying_type_t

template<typename T >
using underlying_type_t = typename underlying_type<T>::type

Definition at line 1157 of file magic_enum.h.

Function Documentation

◆ enum_cast() [1/2]

template<typename E , detail::enum_subtype S = detail::subtype_v<E>, typename BinaryPredicate = std::equal_to<>>
constexpr auto enum_cast ( string_view  value,
BinaryPredicate  p = {} 
) -> detail::enable_if_t<E, optional<std::decay_t<E>>, BinaryPredicate>
constexprnoexcept

Definition at line 1362 of file magic_enum.h.

◆ enum_cast() [2/2]

template<typename E , detail::enum_subtype S = detail::subtype_v<E>>
constexpr auto enum_cast ( underlying_type_t< E >  value) -> detail::enable_if_t<E, optional<std::decay_t<E>>>
constexprnoexcept

Definition at line 1333 of file magic_enum.h.

References magic_enum::detail::flags.

◆ enum_contains() [1/3]

template<typename E , detail::enum_subtype S = detail::subtype_v<E>>
constexpr auto enum_contains ( value) -> detail::enable_if_t<E, bool>
constexprnoexcept

Definition at line 1385 of file magic_enum.h.

◆ enum_contains() [2/3]

template<typename E , detail::enum_subtype S = detail::subtype_v<E>, typename BinaryPredicate = std::equal_to<>>
constexpr auto enum_contains ( string_view  value,
BinaryPredicate  p = {} 
) -> detail::enable_if_t<E, bool, BinaryPredicate>
constexprnoexcept

Definition at line 1411 of file magic_enum.h.

◆ enum_contains() [3/3]

template<typename E , detail::enum_subtype S = detail::subtype_v<E>>
constexpr auto enum_contains ( underlying_type_t< E >  value) -> detail::enable_if_t<E, bool>
constexprnoexcept

Definition at line 1403 of file magic_enum.h.

◆ enum_count()

template<typename E , detail::enum_subtype S = detail::subtype_v<E>>
constexpr auto enum_count ( ) -> detail::enable_if_t<E, std::size_t>
constexprnoexcept

Definition at line 1173 of file magic_enum.h.

◆ enum_entries()

template<typename E , detail::enum_subtype S = detail::subtype_v<E>>
constexpr auto enum_entries ( ) -> detail::enable_if_t<E, detail::entries_t<E, S>>
constexprnoexcept

Definition at line 1320 of file magic_enum.h.

◆ enum_index() [1/2]

template<auto V, detail::enum_subtype S = detail::subtype_v<std::decay_t<decltype(V)>>>
constexpr auto enum_index ( ) -> detail::enable_if_t<decltype(V), std::size_t>
constexprnoexcept

Definition at line 1267 of file magic_enum.h.

◆ enum_index() [2/2]

template<typename E , detail::enum_subtype S = detail::subtype_v<E>>
constexpr auto enum_index ( value) -> detail::enable_if_t<E, optional<std::size_t>>
constexprnoexcept

Definition at line 1227 of file magic_enum.h.

References magic_enum::detail::flags.

◆ enum_integer()

template<typename E >
constexpr auto enum_integer ( value) -> detail::enable_if_t<E, underlying_type_t<E>>
constexprnoexcept

Definition at line 1214 of file magic_enum.h.

◆ enum_name() [1/2]

template<auto V>
constexpr auto enum_name ( ) -> detail::enable_if_t<decltype(V), string_view>
constexprnoexcept

◆ enum_name() [2/2]

template<typename E , detail::enum_subtype S = detail::subtype_v<E>>
constexpr auto enum_name ( value) -> detail::enable_if_t<E, string_view>
constexprnoexcept

Definition at line 1289 of file magic_enum.h.

◆ enum_names()

template<typename E , detail::enum_subtype S = detail::subtype_v<E>>
constexpr auto enum_names ( ) -> detail::enable_if_t<E, detail::names_t<E, S>>
constexprnoexcept

Definition at line 1311 of file magic_enum.h.

◆ enum_reflected() [1/2]

template<typename E , detail::enum_subtype S = detail::subtype_v<E>>
constexpr auto enum_reflected ( value) -> detail::enable_if_t<E, bool>
constexprnoexcept

Definition at line 1433 of file magic_enum.h.

◆ enum_reflected() [2/2]

template<typename E , detail::enum_subtype S = detail::subtype_v<E>>
constexpr auto enum_reflected ( underlying_type_t< E >  value) -> detail::enable_if_t<E, bool>
constexprnoexcept

Definition at line 1419 of file magic_enum.h.

◆ enum_type_name()

template<typename E >
constexpr auto enum_type_name ( ) -> detail::enable_if_t<E, string_view>
constexprnoexcept

Definition at line 1164 of file magic_enum.h.

◆ enum_underlying()

template<typename E >
constexpr auto enum_underlying ( value) -> detail::enable_if_t<E, underlying_type_t<E>>
constexprnoexcept

Definition at line 1220 of file magic_enum.h.

◆ enum_value() [1/2]

template<typename E , std::size_t I, detail::enum_subtype S = detail::subtype_v<E>>
constexpr auto enum_value ( ) -> detail::enable_if_t<E, std::decay_t<E>>
constexprnoexcept

Definition at line 1195 of file magic_enum.h.

◆ enum_value() [2/2]

template<typename E , detail::enum_subtype S = detail::subtype_v<E>>
constexpr auto enum_value ( std::size_t  index) -> detail::enable_if_t<E, std::decay_t<E>>
constexprnoexcept

Definition at line 1180 of file magic_enum.h.

References magic_enum::detail::flags, magic_enum::detail::log2(), and MAGIC_ENUM_ASSERT.

Here is the call graph for this function:

◆ enum_values()

template<typename E , detail::enum_subtype S = detail::subtype_v<E>>
constexpr auto enum_values ( ) -> detail::enable_if_t<E, detail::values_t<E, S>>
constexprnoexcept

Definition at line 1205 of file magic_enum.h.

Variable Documentation

◆ as_common

template<bool AsFlags = true>
constexpr auto as_common = AsFlags ? detail::enum_subtype::common : detail::enum_subtype::flags
inlineconstexpr

Definition at line 1451 of file magic_enum.h.

◆ as_flags

template<bool AsFlags = true>
constexpr auto as_flags = AsFlags ? detail::enum_subtype::flags : detail::enum_subtype::common
inlineconstexpr

Definition at line 1448 of file magic_enum.h.

◆ case_insensitive

constexpr auto case_insensitive = detail::case_insensitive<>{}
inlineconstexpr

Definition at line 1328 of file magic_enum.h.

◆ is_magic_enum_supported

constexpr bool is_magic_enum_supported = detail::supported<void>::value
inlineconstexpr

Definition at line 1130 of file magic_enum.h.

◆ is_scoped_enum_v

template<typename T >
constexpr bool is_scoped_enum_v = is_scoped_enum<T>::value
inlineconstexpr

Definition at line 1149 of file magic_enum.h.

◆ is_unscoped_enum_v

template<typename T >
constexpr bool is_unscoped_enum_v = is_unscoped_enum<T>::value
inlineconstexpr

Definition at line 1141 of file magic_enum.h.