diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 2500c52..2d330a2 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,2 +1 @@ -liberapay: Neargye -custom: https://paypal.me/Neargye +custom: https://btc.com/btc/address/bc1qzevldln8tqz5xf4lyufu9msgl7t97xstth9zq8 diff --git a/doc/reference.md b/doc/reference.md index 5f15c70..2584982 100644 --- a/doc/reference.md +++ b/doc/reference.md @@ -6,6 +6,7 @@ * [`enum_count` returns number of enum values.](#enum_count) * [`enum_integer` obtains integer value from enum value.](#enum_integer) * [`enum_name` returns name from enum value.](#enum_name) +* [`enum_flags_name` returns name from enum-flags value.](#enum_flags_name) * [`enum_names` obtains string enum name sequence.](#enum_names) * [`enum_entries` obtains pair (value enum, string enum name) sequence.](#enum_entries) * [`enum_index` obtains index in enum value sequence from enum value.](#enum_index) @@ -204,6 +205,25 @@ constexpr string_view enum_name() noexcept; // color_name -> "BLUE" ``` +## `enum_flags_name` + +```cpp +template +string enum_flags_name(E value); +``` + +* Returns name from enum-flags value as `string` with null-terminated string. + +* If enum-flags value does not have name or [out of range](limitations.md), returns empty string. + +* Examples + + ```cpp + auto directions_name = magic_enum::enum_flags_name(Directions::Up | Directions::Right); + // directions_name -> "Directions::Up | Directions::Right" + ``` + + ## `enum_names` ```cpp