C++ Logo

std-proposals

Advanced search

Initialisers in ternary operators

From: Dmitry Dmitry <dimanne_at_[hidden]>
Date: Thu, 10 Sep 2020 21:36:03 +0100
Hi,

Since C++17 we can have init-statements in if:
if (*char buf[10];* std::fgets(buf, 10, stdin)) { m[0] += buf; }

That is excellent. But what about ternary operators (?:)?
It seems I cannot write something like this now:
return (*auto It = Cont.find(42);* It == Cont.end()) ? 0 : It->second;

Is it deliberate?
Are there any objections?
What do you think?

-- 
Dmitry
*Sent from gmail*

Received on 2020-09-10 15:40:01