diff --git a/compile-time-programming/requires-expressions.md b/compile-time-programming/requires-expressions.md index b0ad0d3..514e059 100644 --- a/compile-time-programming/requires-expressions.md +++ b/compile-time-programming/requires-expressions.md @@ -97,7 +97,8 @@ A student should be able to: ### Points to cover * Compound-requirements allow the optional ability to test whether an expression is marked as `noexcept`, by using a trailing `noexcept` keyword. - ``` + +```cpp struct S { void foo() noexcept {} @@ -106,7 +107,8 @@ struct S static_assert(requires(S s) { { s.foo() } noexcept; } ); // Succeeds. s.foo() is noexcept static_assert(requires(S s) { { s.bar() } noexcept; } ); // Fails. s.bar() is not noexcept - ``` +``` + * If the return-type-requirement of a compound-requirement is a concept, that concept is given the resulting type as the first parameter, followed by the specified parameters in the compound-requirement. `{ ++x } -> C` would substitute `C` and check that concept C is satisfied for those parameters. ## Advanced