1
0
Fork 0
mirror of https://github.com/Neargye/magic_enum.git synced 2026-01-10 23:44:29 +00:00
This commit is contained in:
neargye 2022-03-08 14:05:43 +02:00
parent 9d1cf196cf
commit 04a3d32d0f
2 changed files with 18 additions and 17 deletions

View file

@ -330,16 +330,16 @@ constexpr string_view enum_type_name() noexcept;
```cpp
template <typename... Es>
[[nodiscard]] constexpr optional<FusedEnum> enum_fuse(Es... values);
[[nodiscard]] constexpr optional<enum_fuse_t> enum_fuse(Es... values);
```
* Returns a typesafe bijective mix of several enum values. This can be used to emulate 2D switch/case statements.
* Return type is `optional<FusedEnum>` where FusedEnum is an incomplete enum. It is unique for any given combination of `Es...`.
* Return type is `optional<enum_fuse_t>` where `enum_fuse_t` is an incomplete enum, it is unique for any given combination of `Es...`.
* Switch/case statement over an incomplete enum is a Visual Studio warning C4064
* You have to silent (/wd4064) or ignore it.
* Alternatively, define MAGIC_ENUM_NO_TYPESAFE_ENUM_FUSE to disable type-safety (FusedEnum equals std::uintmax_t).
* Alternatively, define `MAGIC_ENUM_NO_TYPESAFE_ENUM_FUSE` to disable type-safety (`enum_fuse_t` equals `std::uintmax_t`).
* Examples