update doc

This commit is contained in:
neargye 2020-05-12 13:48:55 +05:00
parent f7aa276086
commit e2a56fa18a

View file

@ -54,19 +54,7 @@
} // namespace nameof
```
* 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>
* Nameof enum obtains the first defined value enums, and won't work if value are aliased.
* Nameof enum won't work if a value is aliased, work with enum-aliases is compiler-implementation-defined.
```cpp
enum ShapeKind {
@ -78,11 +66,11 @@
Banana = 3,
COUNT = 4,
};
// nameof::nameof_enum(ShapeKind::Box) -> "ConvexBegin"
// NAMEOF_ENUM(ShapeKind::Box) -> "ConvexBegin"
// nameof::nameof_enum(ShapeKind::Box) -> "ConvexBegin" or ""
// NAMEOF_ENUM(ShapeKind::Box) -> "ConvexBegin" or ""
```
Work around the issue:
One of the possible workaround the issue:
```cpp
enum ShapeKind {
@ -107,3 +95,17 @@
// nameof::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`.