magic_enum::detail Namespace Reference

Classes

class  case_insensitive
 
struct  enable_if_enum
 
struct  enable_if_enum< true, R >
 
struct  has_is_flags
 
struct  has_is_flags< T, std::void_t< decltype(customize::enum_range< T >::is_flags)> >
 
struct  is_scoped_enum
 
struct  is_scoped_enum< T, true >
 
struct  is_unscoped_enum
 
struct  is_unscoped_enum< T, true >
 
struct  range_max
 
struct  range_max< T, std::void_t< decltype(customize::enum_range< T >::max)> >
 
struct  range_min
 
struct  range_min< T, std::void_t< decltype(customize::enum_range< T >::min)> >
 
class  static_str
 
class  static_str< 0 >
 
struct  str_view
 
struct  supported
 
struct  underlying_type
 
struct  underlying_type< T, true >
 
struct  valid_count_t
 

Typedefs

template<typename T , typename R , typename BinaryPredicate = std::equal_to<>, typename D = std::decay_t<T>>
using enable_if_t = typename enable_if_enum< std::is_enum_v< D > &&std::is_invocable_r_v< bool, BinaryPredicate, char_type, char_type >, R >::type
 
template<typename E , enum_subtype S, typename D = std::decay_t<E>>
using entries_t = decltype((entries_v< D, S >))
 
template<typename T , std::enable_if_t< std::is_enum_v< std::decay_t< T >>, int > = 0>
using enum_concept = T
 
template<auto V, typename E = std::decay_t<decltype(V)>, std::enable_if_t< std::is_enum_v< E >, int > = 0>
using enum_constant = std::integral_constant< E, V >
 
template<typename E , enum_subtype S, typename D = std::decay_t<E>>
using names_t = decltype((names_v< D, S >))
 
template<typename E , enum_subtype S, typename D = std::decay_t<E>>
using values_t = decltype((values_v< D, S >))
 

Enumerations

enum  enum_subtype { common, flags }
 

Functions

template<typename BinaryPredicate >
constexpr bool cmp_equal (string_view lhs, string_view rhs, [[maybe_unused]] BinaryPredicate &&p) noexcept(is_nothrow_invocable< BinaryPredicate >())
 
template<typename L , typename R >
constexpr bool cmp_less (L lhs, R rhs) noexcept
 
template<typename E , enum_subtype S, std::size_t... I>
constexpr auto entries (std::index_sequence< I... >) noexcept
 
template<typename E , E V>
constexpr auto enum_name () noexcept
 
constexpr std::size_t find (string_view str, char_type c) noexcept
 
template<typename BinaryPredicate >
constexpr bool is_default_predicate () noexcept
 
template<typename BinaryPredicate >
constexpr bool is_nothrow_invocable ()
 
template<typename E , enum_subtype S, typename U = std::underlying_type_t<E>>
constexpr bool is_sparse () noexcept
 
template<typename E , auto V>
constexpr bool is_valid () noexcept
 
template<typename I >
constexpr I log2 (I value) noexcept
 
template<typename E >
constexpr auto n () noexcept
 
template<typename E , enum_subtype S, std::size_t... I>
constexpr auto names (std::index_sequence< I... >) noexcept
 
template<typename E , enum_subtype S, typename U = std::underlying_type_t<E>>
constexpr int reflected_max () noexcept
 
template<typename E , enum_subtype S, typename U = std::underlying_type_t<E>>
constexpr int reflected_min () noexcept
 
template<typename T >
constexpr enum_subtype subtype (std::false_type) noexcept
 
template<typename E , typename U = std::underlying_type_t<E>>
constexpr enum_subtype subtype (std::true_type) noexcept
 
template<typename T , std::size_t N, std::size_t... I>
constexpr std::array< std::remove_cv_t< T >, N > to_array (T(&a)[N], std::index_sequence< I... >) noexcept
 
template<typename E >
constexpr auto type_name () noexcept
 
template<typename E , int O, enum_subtype S, typename U = std::underlying_type_t<E>>
constexpr U ualue (std::size_t i) noexcept
 
template<typename E , enum_subtype S, std::size_t Size, int Min>
constexpr auto valid_count () noexcept
 
template<typename E , enum_subtype S, std::size_t Size, int Min, std::size_t I>
constexpr void valid_count (bool *valid, std::size_t &count) noexcept
 
template<typename E , int O, enum_subtype S, typename U = std::underlying_type_t<E>>
constexpr E value (std::size_t i) noexcept
 
template<typename E , enum_subtype S, std::size_t Size, int Min>
constexpr auto values () noexcept
 
template<typename E , enum_subtype S, typename U = std::underlying_type_t<E>>
constexpr auto values () noexcept
 
template<typename E , enum_subtype S, typename U = std::underlying_type_t<E>>
constexpr U values_ors () noexcept
 

Variables

template<typename... T>
constexpr bool always_false_v = false
 
template<typename E , enum_subtype S>
constexpr auto count_v = values_v<E, S>.size()
 
template<typename E , enum_subtype S>
constexpr auto entries_v = entries<E, S>(std::make_index_sequence<count_v<E, S>>{})
 
template<typename E , E V>
constexpr auto enum_name_v = enum_name<E, V>()
 
template<typename T >
constexpr bool is_enum_v = std::is_enum_v<T> && std::is_same_v<T, std::decay_t<T>>
 
template<typename E , enum_subtype S = subtype_v<E>>
constexpr bool is_sparse_v = is_sparse<E, S>()
 
template<typename E , enum_subtype S, typename U = std::underlying_type_t<E>>
constexpr auto max_v = (count_v<E, S> > 0) ? static_cast<U>(values_v<E, S>.back()) : U{0}
 
template<typename E , enum_subtype S, typename U = std::underlying_type_t<E>>
constexpr auto min_v = (count_v<E, S> > 0) ? static_cast<U>(values_v<E, S>.front()) : U{0}
 
template<typename E , enum_subtype S>
constexpr auto names_v = names<E, S>(std::make_index_sequence<count_v<E, S>>{})
 
template<typename E , typename D = std::decay_t<E>>
constexpr auto subtype_v = subtype<D>(std::is_enum<D>{})
 
template<typename E >
constexpr auto type_name_v = type_name<E>()
 
template<typename E , enum_subtype S>
constexpr auto values_v = values<E, S>()
 

Typedef Documentation

◆ enable_if_t

using enable_if_t = typename enable_if_enum<std::is_enum_v<D> && std::is_invocable_r_v<bool, BinaryPredicate, char_type, char_type>, R>::type

Definition at line 860 of file magic_enum.hpp.

◆ entries_t

using entries_t = decltype((entries_v<D, S>))

Definition at line 818 of file magic_enum.hpp.

◆ enum_concept

using enum_concept = T

Definition at line 863 of file magic_enum.hpp.

◆ enum_constant

using enum_constant = std::integral_constant<E, V>

Definition at line 225 of file magic_enum.hpp.

◆ names_t

using names_t = decltype((names_v<D, S>))

Definition at line 807 of file magic_enum.hpp.

◆ values_t

using values_t = decltype((values_v<D, S>))

Definition at line 787 of file magic_enum.hpp.

Enumeration Type Documentation

◆ enum_subtype

enum enum_subtype
strong
Enumerator
common 
flags 

Definition at line 616 of file magic_enum.hpp.

Function Documentation

◆ cmp_equal()

constexpr bool magic_enum::detail::cmp_equal ( string_view  lhs,
string_view  rhs,
[[maybe_unused] ] BinaryPredicate &&  p 
)
constexprnoexcept

Definition at line 344 of file magic_enum.hpp.

◆ cmp_less()

constexpr bool magic_enum::detail::cmp_less ( lhs,
rhs 
)
constexprnoexcept

Definition at line 372 of file magic_enum.hpp.

+ Here is the caller graph for this function:

◆ entries()

constexpr auto magic_enum::detail::entries ( std::index_sequence< I... >  )
constexprnoexcept

Definition at line 810 of file magic_enum.hpp.

+ Here is the caller graph for this function:

◆ enum_name()

constexpr auto magic_enum::detail::enum_name ( )
constexprnoexcept

Definition at line 567 of file magic_enum.hpp.

+ Here is the call graph for this function:

◆ find()

constexpr std::size_t magic_enum::detail::find ( string_view  str,
char_type  c 
)
constexprnoexcept

Definition at line 309 of file magic_enum.hpp.

+ Here is the call graph for this function:

◆ is_default_predicate()

constexpr bool magic_enum::detail::is_default_predicate ( )
constexprnoexcept

Definition at line 332 of file magic_enum.hpp.

◆ is_nothrow_invocable()

constexpr bool magic_enum::detail::is_nothrow_invocable ( )
constexpr

Definition at line 338 of file magic_enum.hpp.

◆ is_sparse()

constexpr bool magic_enum::detail::is_sparse ( )
constexprnoexcept

Definition at line 821 of file magic_enum.hpp.

+ Here is the call graph for this function:

◆ is_valid()

constexpr bool magic_enum::detail::is_valid ( )
constexprnoexcept

Definition at line 592 of file magic_enum.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ log2()

constexpr I magic_enum::detail::log2 ( value)
constexprnoexcept

Definition at line 392 of file magic_enum.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n()

constexpr auto n ( )
constexprnoexcept

Definition at line 418 of file magic_enum.hpp.

◆ names()

constexpr auto magic_enum::detail::names ( std::index_sequence< I... >  )
constexprnoexcept

Definition at line 799 of file magic_enum.hpp.

◆ reflected_max()

constexpr int magic_enum::detail::reflected_max ( )
constexprnoexcept

Definition at line 656 of file magic_enum.hpp.

+ Here is the call graph for this function:

◆ reflected_min()

constexpr int magic_enum::detail::reflected_min ( )
constexprnoexcept

Definition at line 640 of file magic_enum.hpp.

+ Here is the call graph for this function:

◆ subtype() [1/2]

constexpr enum_subtype magic_enum::detail::subtype ( std::false_type  )
constexprnoexcept

Definition at line 775 of file magic_enum.hpp.

◆ subtype() [2/2]

constexpr enum_subtype magic_enum::detail::subtype ( std::true_type  )
constexprnoexcept

Definition at line 749 of file magic_enum.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ to_array()

constexpr std::array<std::remove_cv_t<T>, N> magic_enum::detail::to_array ( T(&)  a[N],
std::index_sequence< I... >   
)
constexprnoexcept

Definition at line 409 of file magic_enum.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ type_name()

constexpr auto magic_enum::detail::type_name ( )
constexprnoexcept

Definition at line 459 of file magic_enum.hpp.

+ Here is the call graph for this function:

◆ ualue()

constexpr U magic_enum::detail::ualue ( std::size_t  i)
constexprnoexcept

Definition at line 622 of file magic_enum.hpp.

◆ valid_count() [1/2]

constexpr auto magic_enum::detail::valid_count ( )
constexprnoexcept

Definition at line 706 of file magic_enum.hpp.

◆ valid_count() [2/2]

constexpr void magic_enum::detail::valid_count ( bool *  valid,
std::size_t &  count 
)
constexprnoexcept

Definition at line 682 of file magic_enum.hpp.

◆ value()

constexpr E magic_enum::detail::value ( std::size_t  i)
constexprnoexcept

Definition at line 635 of file magic_enum.hpp.

+ Here is the caller graph for this function:

◆ values() [1/2]

constexpr auto magic_enum::detail::values ( )
constexprnoexcept

Definition at line 713 of file magic_enum.hpp.

+ Here is the call graph for this function:

◆ values() [2/2]

constexpr auto magic_enum::detail::values ( )
constexprnoexcept

Definition at line 738 of file magic_enum.hpp.

+ Here is the call graph for this function:

◆ values_ors()

constexpr U magic_enum::detail::values_ors ( )
constexprnoexcept

Definition at line 839 of file magic_enum.hpp.

Variable Documentation

◆ always_false_v

constexpr bool always_false_v = false
inlineconstexpr

Definition at line 228 of file magic_enum.hpp.

◆ count_v

constexpr auto count_v = values_v<E, S>.size()
inlineconstexpr

Definition at line 790 of file magic_enum.hpp.

◆ entries_v

constexpr auto entries_v = entries<E, S>(std::make_index_sequence<count_v<E, S>>{})
inlineconstexpr

Definition at line 815 of file magic_enum.hpp.

◆ enum_name_v

constexpr auto enum_name_v = enum_name<E, V>()
inlineconstexpr

Definition at line 589 of file magic_enum.hpp.

◆ is_enum_v

constexpr bool is_enum_v = std::is_enum_v<T> && std::is_same_v<T, std::decay_t<T>>
inlineconstexpr

Definition at line 415 of file magic_enum.hpp.

◆ is_sparse_v

constexpr bool is_sparse_v = is_sparse<E, S>()
inlineconstexpr

Definition at line 836 of file magic_enum.hpp.

◆ max_v

constexpr auto max_v = (count_v<E, S> > 0) ? static_cast<U>(values_v<E, S>.back()) : U{0}
inlineconstexpr

Definition at line 796 of file magic_enum.hpp.

◆ min_v

constexpr auto min_v = (count_v<E, S> > 0) ? static_cast<U>(values_v<E, S>.front()) : U{0}
inlineconstexpr

Definition at line 793 of file magic_enum.hpp.

◆ names_v

constexpr auto names_v = names<E, S>(std::make_index_sequence<count_v<E, S>>{})
inlineconstexpr

Definition at line 804 of file magic_enum.hpp.

◆ subtype_v

constexpr auto subtype_v = subtype<D>(std::is_enum<D>{})
inlineconstexpr

Definition at line 781 of file magic_enum.hpp.

◆ type_name_v

constexpr auto type_name_v = type_name<E>()
inlineconstexpr

Definition at line 477 of file magic_enum.hpp.

◆ values_v

constexpr auto values_v = values<E, S>()
inlineconstexpr

Definition at line 784 of file magic_enum.hpp.