Template:cpp/ub if
If {{{1}}}, the behavior is undefined
These are templates that are used to describe the constraints, mandated requirements and preconditions of standard library functions.
{{cpp/enable if|constraint |plural=yes or no (optional)}} - creates one or more constraints. Specify the “plural” parameter as “yes” to apply the constraint to multiple overloads.
Usage | Result |
---|---|
{{cpp/enable if|{{tt|T}} is not {{c/core|void}}}}.
|
This overload participates in overload resolution only if T is not void.
|
{{cpp/enable if|plural=yes|all following conditions are satisfied}}:
|
These overloads participate in overload resolution only if all following conditions are satisfied:
|
{{cpp/error if|mandated requirement (negated) }} - creates one or more mandated requirements.
Usage | Result |
---|---|
{{cpp/error if|{{tt|T}} is not {{named req|CopyConstructible}}}}.
|
If T is not CopyConstructible, the program is ill-formed.
|
{{cpp/error if|any of the following conditions is satisfied}}:
|
If any of the following conditions is satisfied, the program is ill-formed:
|
{{cpp/ub if|precondition (negated) }} - creates one or more preconditions.
Usage | Result |
---|---|
{{cpp/ub if|{{c|num < 0}} is {{c|true}}}}.
|
If num < 0 is true, the behavior is undefined. |
{{cpp/ub if|any of the following conditions is satisfied}}:
|
If any of the following conditions is satisfied, the behavior is undefined:
|
{{cpp/hardened ub if|hardened precondition (negated) |since=hardening version (optional)}} - creates one or more hardened preconditions. If the precondition is hardened from a specified version, it can be specified by the “since” parameter.
Usage | Result | ||||
---|---|---|---|---|---|
{{cpp/hardened ub if|{{c|num < 0}} is {{c|true}}}}
|
If num < 0 is true:
| ||||
{{cpp/hardened ub if|since=c++26|{{c|pos < 0}} is {{c|true}}}}
|
|
The above documentation is transcluded from Template:cpp/enable if/doc. (edit | history) Subpages of this template. |