1
0
Fork 0
mirror of https://github.com/Neargye/magic_enum.git synced 2026-01-09 23:34:23 +00:00
This commit is contained in:
neargye 2020-12-29 18:56:51 +02:00
parent 6654d24a82
commit 806f2530ef
3 changed files with 27 additions and 25 deletions

View file

@ -13,7 +13,7 @@
* [`enum_type_name` returns type name of enum.](#enum_type_name)
* [`is_unscoped_enum` checks whether type is an Unscoped enumeration.](#is_unscoped_enum)
* [`is_scoped_enum` checks whether type is an Scoped enumeration.](#is_scoped_enum)
* [`underlying_type` improved UB-free "SFINAE-friendly" std::underlying_type.](#underlying_type)
* [`underlying_type` improved UB-free "SFINAE-friendly" underlying_type.](#underlying_type)
* [`ostream_operators` ostream operators for enums.](#ostream_operators)
* [`bitwise_operators` bitwise operators for enums.](#bitwise_operators)
@ -41,9 +41,9 @@ constexpr optional<E> enum_cast(string_view value, BinaryPredicate p) noexcept(i
* Obtains enum value from string or integer.
* Returns `std::optional<E>`, using `has_value()` to check contains enum value and `value()` to get the enum value.
* Returns `optional<E>`, using `has_value()` to check contains enum value and `value()` to get the enum value.
* If argument does not enum value, returns empty `std::optional`.
* If argument does not enum value, returns empty `optional`.
* Examples
@ -93,7 +93,7 @@ template <typename E>
constexpr array<E, N> enum_values() noexcept;
```
* Returns `std::array<E, N>` with all enum values where `N = number of enum values`, sorted by enum value.
* Returns `array<E, N>` with all enum values where `N = number of enum values`, sorted by enum value.
* Examples
@ -146,7 +146,7 @@ template <auto V>
constexpr string_view enum_name() noexcept;
```
* Returns name from enum value as `std::string_view` with null-terminated string.
* Returns name from enum value as `string_view` with null-terminated string.
* If enum value does not have name or [out of range](limitations.md), `enum_name(value)` returns empty string.
* If enum value does not have name, `enum_name<value>()` occurs the compilation error `"Enum value does not have a name."`.
@ -177,7 +177,7 @@ template <typename E>
constexpr array<string_view, N> enum_names() noexcept;
```
* Returns `std::array<std::string_view, N>` with all names where `N = number of enum values`, sorted by enum value.
* Returns `array<string_view, N>` with all names where `N = number of enum values`, sorted by enum value.
* Examples
@ -194,7 +194,7 @@ template <typename E>
constexpr array<pair<E, string_view>, N> enum_entries() noexcept;
```
* Returns `std::array<std::pair<E, std::string_view>, N>` with all pairs (value, name) where `N = number of enum values`, sorted by enum value.
* Returns `array<pair<E, string_view>, N>` with all pairs (value, name) where `N = number of enum values`, sorted by enum value.
* Examples
@ -214,7 +214,7 @@ constexpr optional<size_t> enum_index() noexcept;
* Obtains index in enum values from enum value.
* Returns `std::optional<std::size_t>` with index.
* Returns `optional<size_t>` with index.
* Examples
@ -261,7 +261,7 @@ template <typename E>
constexpr string_view enum_type_name() noexcept;
```
* Returns type name of enum as `std::string_view` null-terminated string.
* Returns type name of enum as `string_view` null-terminated string.
* Examples
@ -331,7 +331,7 @@ template <typename T>
using underlying_type_t = typename underlying_type<T>::type;
```
* Improved UB-free "SFINAE-friendly" [std::underlying_type](https://en.cppreference.com/w/cpp/types/underlying_type).
* Improved UB-free "SFINAE-friendly" [underlying_type](https://en.cppreference.com/w/cpp/types/underlying_type).
* If T is a complete enumeration type, provides a member typedef type that names the underlying type of T.</br>
Otherwise, if T is not an enumeration type, there is no member type.</br>