Statement that is not a complete expression

It is often heard that in C ++ temporary objects are deconstructed at the end of the full expression. A full expression is defined as an expression that is not a sub-expression of any other expression. That sounds a lot like the idea of ​​my statement.

So my questions are: if I add a half-point to the full expression, will this always be a statement? Is it possible to arrive at every complete expression by accepting some statement with a colon at the end and removing this half-column? Can I assume that every temporary will live until the end of its approval?

+4
source share
1 answer

, :

if (T() == T())
  foo();

, , , (foo();).

, e, e ; - ( , . [stmt.expr]).

+3

Source: https://habr.com/ru/post/1671077/


All Articles