Re:What's new in C++26 (part 1)
by muststopmyths on Saturday September 07, 2024 @09:43AM
(#41473901)
You are using definitions that I am not familiar with. Maybe it's because we speak different programming languages :-)
x = y is an expression statement in C++, which can be evaluated in an "if" for its side-effects.
This is a contradiction. There is no expression in my code that evaluates to s. foo() is an expression, and then std::string s = ... is assignment initialisation, which is not an expression.
Edit: I suppose that if I used another form of initialisation, the answer becomes a bit more obvious:
(Not that this makes sense but just the point is to use a constructor with more than one argument.) In this case it's clear the test has to be the just-initialised variable. In fact there could be no arguments at all!