Template:cpp/language/condition
From cppreference.com
Contents |
[edit] Condition
A condition can either be an expression or a simple declaration.
|
(since C++26) |
- If it can be syntactically resolved as an expression, it is treated as an expression. Otherwise, it is treated as a declaration that is not a structured binding declaration(since C++26).
When control reaches condition, the condition will yield a value, which is used to .
[edit] Expression
If condition is an expression, the value it yields is the the value of the expression.
[edit] Declaration
If condition is a simple declaration, the value it yields is the value of the decision variable (see below).
[edit] Non-structured binding declaration
The declaration has the following restrictions:
- Syntactically conforms to the following form:
|
(until C++11) |
|
(since C++11) |
- The declarator cannot specify a function or an array.
- The type specifier sequence(until C++11)declaration specifier sequence can only contain type specifiers and constexpr, and it(since C++11) cannot define a class or enumeration.
The decision varaiable of the declaration is the declared variable.
Structured binding declarationThe declaration has the following restrictions:
The decision variable of the declaration is the invented variable e introduced by the declaration. |
(since C++26) |