update doc
This commit is contained in:
parent
f7aa276086
commit
e2a56fa18a
1 changed files with 18 additions and 16 deletions
|
@ -54,19 +54,7 @@
|
||||||
} // namespace nameof
|
} // namespace nameof
|
||||||
```
|
```
|
||||||
|
|
||||||
* If you hit a message like this:
|
* Nameof enum won't work if a value is aliased, work with enum-aliases is compiler-implementation-defined.
|
||||||
|
|
||||||
```text
|
|
||||||
[...]
|
|
||||||
note: constexpr evaluation hit maximum step limit; possible infinite loop?
|
|
||||||
```
|
|
||||||
|
|
||||||
Change the limit for the number of constexpr evaluated:
|
|
||||||
* MSVC `/constexpr:depthN`, `/constexpr:stepsN` <https://docs.microsoft.com/en-us/cpp/build/reference/constexpr-control-constexpr-evaluation>
|
|
||||||
* Clang `-fconstexpr-depth=N`, `-fconstexpr-steps=N` <https://clang.llvm.org/docs/UsersManual.html#controlling-implementation-limits>
|
|
||||||
* GCC `-fconstexpr-depth=N`, `-fconstexpr-loop-limit=N`, `-fconstexpr-ops-limit=N` <https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/C_002b_002b-Dialect-Options.html>
|
|
||||||
|
|
||||||
* Nameof enum obtains the first defined value enums, and won't work if value are aliased.
|
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
enum ShapeKind {
|
enum ShapeKind {
|
||||||
|
@ -78,11 +66,11 @@
|
||||||
Banana = 3,
|
Banana = 3,
|
||||||
COUNT = 4,
|
COUNT = 4,
|
||||||
};
|
};
|
||||||
// nameof::nameof_enum(ShapeKind::Box) -> "ConvexBegin"
|
// nameof::nameof_enum(ShapeKind::Box) -> "ConvexBegin" or ""
|
||||||
// NAMEOF_ENUM(ShapeKind::Box) -> "ConvexBegin"
|
// NAMEOF_ENUM(ShapeKind::Box) -> "ConvexBegin" or ""
|
||||||
```
|
```
|
||||||
|
|
||||||
Work around the issue:
|
One of the possible workaround the issue:
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
enum ShapeKind {
|
enum ShapeKind {
|
||||||
|
@ -107,3 +95,17 @@
|
||||||
// nameof::nameof_enum(ShapeKind::ConvexBegin) -> "Box"
|
// nameof::nameof_enum(ShapeKind::ConvexBegin) -> "Box"
|
||||||
// NAMEOF_ENUM(ShapeKind::ConvexBegin) -> "Box"
|
// NAMEOF_ENUM(ShapeKind::ConvexBegin) -> "Box"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* If you hit a message like this:
|
||||||
|
|
||||||
|
```text
|
||||||
|
[...]
|
||||||
|
note: constexpr evaluation hit maximum step limit; possible infinite loop?
|
||||||
|
```
|
||||||
|
|
||||||
|
Change the limit for the number of constexpr evaluated:
|
||||||
|
* MSVC `/constexpr:depthN`, `/constexpr:stepsN` <https://docs.microsoft.com/en-us/cpp/build/reference/constexpr-control-constexpr-evaluation>
|
||||||
|
* Clang `-fconstexpr-depth=N`, `-fconstexpr-steps=N` <https://clang.llvm.org/docs/UsersManual.html#controlling-implementation-limits>
|
||||||
|
* GCC `-fconstexpr-depth=N`, `-fconstexpr-loop-limit=N`, `-fconstexpr-ops-limit=N` <https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/C_002b_002b-Dialect-Options.html>
|
||||||
|
|
||||||
|
* Intellisense Visual Studio may have some problems analyzing `nameof`.
|
||||||
|
|
Loading…
Reference in a new issue