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:
Pavel I. Kryukov 2022-02-19 14:09:33 +03:00 committed by GitHub
parent ec87fc976c
commit c9388f1c99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View file

@ -330,7 +330,7 @@ constexpr string_view enum_type_name() noexcept;
```cpp
template <typename... Es>
[[nodiscard]] constexpr std::size_t enum_fuse(Es... values);
[[nodiscard]] constexpr optional<std::uintmax_t> enum_fuse(Es... values);
```
* Returns a bijective mix of several enum values. This can be used to emulate 2D switch/case statements.
@ -338,9 +338,9 @@ template <typename... Es>
* Examples
```cpp
switch (magic_enum::enum_fuse(color, direction)) {
case magic_enum::enum_fuse(Color::RED, Directions::Up): // ...
case magic_enum::enum_fuse(Color::BLUE, Directions::Down): // ...
switch (magic_enum::enum_fuse(color, direction).value()) {
case magic_enum::enum_fuse(Color::RED, Directions::Up).value(): // ...
case magic_enum::enum_fuse(Color::BLUE, Directions::Down).value(): // ...
// ...
}
```