C++17 Init statement for if/switch

Daniel Kozak via Digitalmars-d digitalmars-d at puremagic.com
Tue Aug 15 11:55:57 PDT 2017


C++17 will have this feature:
https://tech.io/playgrounds/2205/7-features-of-c17-that-will-simplify-your-code/init-statement-for-ifswitch

What do you think about it, can we have something similar to that.
Maybe something like this:


int func() return 5;

with(auto x = func()) if (condition(x))
     do_something_with(x);
else
     do_something_else_with(x);


More information about the Digitalmars-d mailing list