mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2024-03-22 13:30:58 +08:00
Use a variable in the erroring constexpr example …
I don't see why it'd fail otherwise, so I assume the "2" was a typo Also add a missing "f" to "side effect"
This commit is contained in:
parent
6845e84f0b
commit
e4e22f9e48
|
@ -1793,10 +1793,10 @@ it just guarantees that the function can be evaluated at compile time for consta
|
|||
int m1 = min(-1,2); // probably compile-time evaluation
|
||||
constexpr int m2 = min(-1,2); // compile-time evaluation
|
||||
int m3 = min(-1,v); // run-time evaluation
|
||||
constexpr int m4 = min(-1,2); // error: connot evaluate at compile-time
|
||||
constexpr int m4 = min(-1,v); // error: connot evaluate at compile-time
|
||||
}
|
||||
|
||||
**Note**: `constexpr` functions are pure: they can have no sideefects.
|
||||
**Note**: `constexpr` functions are pure: they can have no side effects.
|
||||
|
||||
int dcount = 0;
|
||||
constexpr int double(int v)
|
||||
|
|
Loading…
Reference in New Issue
Block a user