Skip to main content

magic_enum

C++ API reference for the namespace magic_enum.

Public API

Free Function: enum_cast

Canonical path: magic_enum::enum_cast

Declared in: include/magic_enum/magic_enum.hpp

Signatures

[[nodiscard]] constexpr auto enum_cast(string_view value, [[maybe_unused]] BinaryPredicate p = {}) noexcept(detail::is_nothrow_invocable_v<BinaryPredicate>) -> detail::enable_if_t<E, optional<std::decay_t<E>>, BinaryPredicate>;
[[nodiscard]] constexpr auto enum_cast(underlying_type_t<E> value) noexcept -> detail::enable_if_t<E, optional<std::decay_t<E>>>;

Free Function: enum_contains

Canonical path: magic_enum::enum_contains

Declared in: include/magic_enum/magic_enum.hpp

Signatures

[[nodiscard]] constexpr auto enum_contains(E value) noexcept -> detail::enable_if_t<E, bool>;
[[nodiscard]] constexpr auto enum_contains(string_view value, BinaryPredicate p = {}) noexcept(detail::is_nothrow_invocable_v<BinaryPredicate>) -> detail::enable_if_t<E, bool, BinaryPredicate>;
[[nodiscard]] constexpr auto enum_contains(underlying_type_t<E> value) noexcept -> detail::enable_if_t<E, bool>;

Free Function: enum_count

Canonical path: magic_enum::enum_count

Declared in: include/magic_enum/magic_enum.hpp

Signature

[[nodiscard]] constexpr auto enum_count() noexcept -> detail::enable_if_t<E, std::size_t>;

Free Function: enum_entries

Canonical path: magic_enum::enum_entries

Declared in: include/magic_enum/magic_enum.hpp

Signature

[[nodiscard]] constexpr auto enum_entries() noexcept -> detail::enable_if_t<E, detail::entries_t<E, S>>;

Free Function: enum_flags_cast

Canonical path: magic_enum::enum_flags_cast

Declared in: include/magic_enum/magic_enum_flags.hpp

Signatures

[[nodiscard]] constexpr auto enum_flags_cast(string_view value, [[maybe_unused]] BinaryPredicate p = {}) noexcept(detail::is_nothrow_invocable_v<BinaryPredicate>) -> detail::enable_if_t<E, optional<std::decay_t<E>>, BinaryPredicate>;
[[nodiscard]] constexpr auto enum_flags_cast(underlying_type_t<E> value) noexcept -> detail::enable_if_t<E, optional<std::decay_t<E>>>;

Free Function: enum_flags_contains

Canonical path: magic_enum::enum_flags_contains

Declared in: include/magic_enum/magic_enum_flags.hpp

Signatures

[[nodiscard]] constexpr auto enum_flags_contains(E value) noexcept -> detail::enable_if_t<E, bool>;
[[nodiscard]] constexpr auto enum_flags_contains(string_view value, BinaryPredicate p = {}) noexcept(detail::is_nothrow_invocable_v<BinaryPredicate>) -> detail::enable_if_t<E, bool, BinaryPredicate>;
[[nodiscard]] constexpr auto enum_flags_contains(underlying_type_t<E> value) noexcept -> detail::enable_if_t<E, bool>;

Free Function: enum_flags_name

Canonical path: magic_enum::enum_flags_name

Declared in: include/magic_enum/magic_enum_flags.hpp

Signature

[[nodiscard]] auto enum_flags_name(E value, char_type sep = static_cast<char_type>('|')) -> detail::enable_if_t<E, string>;

Free Function: enum_flags_test

Canonical path: magic_enum::enum_flags_test

Declared in: include/magic_enum/magic_enum_flags.hpp

Signature

constexpr auto enum_flags_test(E flags, E flag) noexcept -> detail::enable_if_t<E, bool>;

Free Function: enum_flags_test_any

Canonical path: magic_enum::enum_flags_test_any

Declared in: include/magic_enum/magic_enum_flags.hpp

Signature

constexpr auto enum_flags_test_any(E lhs, E rhs) noexcept -> detail::enable_if_t<E, bool>;

Free Function: enum_for_each

Canonical path: magic_enum::enum_for_each

Declared in: include/magic_enum/magic_enum_utility.hpp

Signature

constexpr auto enum_for_each(F&& f);

Free Function: enum_fuse

Canonical path: magic_enum::enum_fuse

Declared in: include/magic_enum/magic_enum_fuse.hpp

Signature

[[nodiscard]] constexpr auto enum_fuse(Es... values) noexcept;

Free Function: enum_index

Canonical path: magic_enum::enum_index

Declared in: include/magic_enum/magic_enum.hpp

Signatures

[[nodiscard]] constexpr auto enum_index() noexcept -> detail::enable_if_t<decltype(V), std::size_t>;
[[nodiscard]] constexpr auto enum_index(E value) noexcept -> detail::enable_if_t<E, optional<std::size_t>>;

Free Function: enum_integer

Canonical path: magic_enum::enum_integer

Declared in: include/magic_enum/magic_enum.hpp

Signature

[[nodiscard]] constexpr auto enum_integer(E value) noexcept -> underlying_type_t<E>;

Free Function: enum_name

Canonical path: magic_enum::enum_name

Declared in: include/magic_enum/magic_enum.hpp

Signatures

[[nodiscard]] constexpr auto enum_name() noexcept -> detail::enable_if_t<decltype(V), string_view>;
[[nodiscard]] constexpr auto enum_name(E value) noexcept -> detail::enable_if_t<E, string_view>;

Free Function: enum_names

Canonical path: magic_enum::enum_names

Declared in: include/magic_enum/magic_enum.hpp

Signature

[[nodiscard]] constexpr auto enum_names() noexcept -> detail::enable_if_t<E, detail::names_t<E, S>>;

Free Function: enum_next_value

Canonical path: magic_enum::enum_next_value

Declared in: include/magic_enum/magic_enum_utility.hpp

Signature

[[nodiscard]] constexpr auto enum_next_value(E value, std::ptrdiff_t n = 1) noexcept -> detail::enable_if_t<E, optional<std::decay_t<E>>>;

Free Function: enum_next_value_circular

Canonical path: magic_enum::enum_next_value_circular

Declared in: include/magic_enum/magic_enum_utility.hpp

Signature

[[nodiscard]] constexpr auto enum_next_value_circular(E value, std::ptrdiff_t n = 1) noexcept -> detail::enable_if_t<E, std::decay_t<E>>;

Free Function: enum_prev_value

Canonical path: magic_enum::enum_prev_value

Declared in: include/magic_enum/magic_enum_utility.hpp

Signature

[[nodiscard]] constexpr auto enum_prev_value(E value, std::ptrdiff_t n = 1) noexcept -> detail::enable_if_t<E, optional<std::decay_t<E>>>;

Free Function: enum_prev_value_circular

Canonical path: magic_enum::enum_prev_value_circular

Declared in: include/magic_enum/magic_enum_utility.hpp

Signature

[[nodiscard]] constexpr auto enum_prev_value_circular(E value, std::ptrdiff_t n = 1) noexcept -> detail::enable_if_t<E, std::decay_t<E>>;

Free Function: enum_reflected

Canonical path: magic_enum::enum_reflected

Declared in: include/magic_enum/magic_enum.hpp

Signatures

[[nodiscard]] constexpr auto enum_reflected(E value) noexcept -> detail::enable_if_t<E, bool>;
[[nodiscard]] constexpr auto enum_reflected(underlying_type_t<E> value) noexcept -> detail::enable_if_t<E, bool>;

Free Function: enum_switch

Canonical path: magic_enum::enum_switch

Declared in: include/magic_enum/magic_enum_switch.hpp

Signatures

constexpr decltype(auto) enum_switch(F&& f, E value);
constexpr decltype(auto) enum_switch(F&& f, E value, Result&& result);

Free Function: enum_type_name

Canonical path: magic_enum::enum_type_name

Declared in: include/magic_enum/magic_enum.hpp

Signature

[[nodiscard]] constexpr auto enum_type_name() noexcept -> detail::enable_if_t<E, string_view>;

Free Function: enum_underlying

Canonical path: magic_enum::enum_underlying

Declared in: include/magic_enum/magic_enum.hpp

Signature

[[nodiscard]] constexpr auto enum_underlying(E value) noexcept -> detail::enable_if_t<E, underlying_type_t<E>>;

Free Function: enum_value

Canonical path: magic_enum::enum_value

Declared in: include/magic_enum/magic_enum.hpp

Signatures

[[nodiscard]] constexpr auto enum_value() noexcept -> detail::enable_if_t<E, std::decay_t<E>>;
[[nodiscard]] constexpr auto enum_value(std::size_t index) noexcept -> detail::enable_if_t<E, std::decay_t<E>>;

Free Function: enum_values

Canonical path: magic_enum::enum_values

Declared in: include/magic_enum/magic_enum.hpp

Signature

[[nodiscard]] constexpr auto enum_values() noexcept -> detail::enable_if_t<E, detail::values_t<E, S>>;

Struct: is_scoped_enum

Canonical path: magic_enum::is_scoped_enum

Declared in: include/magic_enum/magic_enum.hpp

Signature

struct is_scoped_enum : detail::is_scoped_enum<T> {};

Struct: is_unscoped_enum

Canonical path: magic_enum::is_unscoped_enum

Declared in: include/magic_enum/magic_enum.hpp

Signature

struct is_unscoped_enum : detail::is_unscoped_enum<T> {};

Struct: underlying_type

Canonical path: magic_enum::underlying_type

Declared in: include/magic_enum/magic_enum.hpp

Signature

struct underlying_type : detail::underlying_type<T> {};