C++17 Init statement for if/switch
Daniel Kozak via Digitalmars-d
digitalmars-d at puremagic.com
Tue Aug 15 12:24:00 PDT 2017
On Tuesday, 15 August 2017 at 19:04:32 UTC, Daniel Kozak wrote:
> On Tuesday, 15 August 2017 at 18:55:57 UTC, Daniel Kozak wrote:
>> C++17 will have this feature:
>> int func() return 5;
>>
>> with(auto x = func()) if (condition(x))
>> do_something_with(x);
>> else
>> do_something_else_with(x);
>
> this would be rewrite to
>
> int func() return 5;
>
> {
> auto x = func();
> if (condition(x))
> do_something_with(x);
> else
> do_something_else_with(x);
> }
int func() { return 5; }
More information about the Digitalmars-d
mailing list