C++17 feature proposal: If statement with initializer

140 views
Skip to first unread message

Andrew Rayskiy

unread,
Dec 27, 2021, 9:42:34 AM12/27/21
to cxx
Hi everyone,


The use-cases and reasoning are nicely justified in the initial std proposal: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0305r0.html

With that in mind, I'm nominating this to be allowed in the Chromium codebase.

Looking forward to your opinions!
Andrew

Peter Kasting

unread,
Dec 27, 2021, 10:05:40 AM12/27/21
to Andrew Rayskiy, cxx
+1

PK

--
You received this message because you are subscribed to the Google Groups "cxx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cxx+uns...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/27acc3cd-7882-4e68-996e-d1e484019cbcn%40chromium.org.

Amr Aboelkher

unread,
Dec 27, 2021, 10:19:52 AM12/27/21
to cxx, Peter Kasting, cxx, Andrew Rayskiy
+1

Roland Bock

unread,
Dec 29, 2021, 4:17:50 AM12/29/21
to cxx, Peter Kasting, Andrew Rayskiy, Amr Aboelkher
+1
This is one of my favorite C++17 features as well (great for reducing scope pollution).

Avi Drissman

unread,
Dec 29, 2021, 11:05:01 AM12/29/21
to Roland Bock, cxx, Peter Kasting, Andrew Rayskiy, Amr Aboelkher

Jeremy Roman

unread,
Dec 29, 2021, 11:52:13 AM12/29/21
to Avi Drissman, Roland Bock, cxx, Peter Kasting, Andrew Rayskiy, Amr Aboelkher
+1; nice quality of life feature without major drawbacks.

Peter Kasting

unread,
Dec 29, 2021, 1:45:04 PM12/29/21
to Andrew Rayskiy, cxx
This seems non-controversial, so I suggest writing a CL to move it to the "approved" section (and maybe convert one or two uses in the codebase to use it).  I'm happy to review.

PK

Andrew Rayskiy

unread,
Jan 4, 2022, 8:29:21 AM1/4/22
to cxx, Peter Kasting, cxx
Please take a look at crrev/c/3360661 then :)
Reply all
Reply to author
Forward
0 new messages