mirror of
https://github.com/Neargye/magic_enum.git
synced 2026-01-09 23:34:23 +00:00
Fix docs (#144)
This commit is contained in:
parent
ec87fc976c
commit
c9388f1c99
2 changed files with 7 additions and 7 deletions
|
|
@ -141,9 +141,9 @@ enum class Color { RED = 2, BLUE = 4, GREEN = 8 };
|
||||||
* Enum fusion for multi-level switch/case statements
|
* Enum fusion for multi-level switch/case statements
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
switch (magic_enum::enum_fuse(color, direction)) {
|
switch (magic_enum::enum_fuse(color, direction).value()) {
|
||||||
case magic_enum::enum_fuse(Color::RED, Directions::Up): // ...
|
case magic_enum::enum_fuse(Color::RED, Directions::Up).value(): // ...
|
||||||
case magic_enum::enum_fuse(Color::BLUE, Directions::Down): // ...
|
case magic_enum::enum_fuse(Color::BLUE, Directions::Down).value(): // ...
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -330,7 +330,7 @@ constexpr string_view enum_type_name() noexcept;
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
template <typename... Es>
|
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.
|
* 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
|
* Examples
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
switch (magic_enum::enum_fuse(color, direction)) {
|
switch (magic_enum::enum_fuse(color, direction).value()) {
|
||||||
case magic_enum::enum_fuse(Color::RED, Directions::Up): // ...
|
case magic_enum::enum_fuse(Color::RED, Directions::Up).value(): // ...
|
||||||
case magic_enum::enum_fuse(Color::BLUE, Directions::Down): // ...
|
case magic_enum::enum_fuse(Color::BLUE, Directions::Down).value(): // ...
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue