On 08/15/2017 08:55 PM, Daniel Kozak wrote:
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);
Previous discussion:
http://forum.dlang.org/post/vfjlpvpwuyfqoljvp...@forum.dlang.org
Andrei doesn't like the C++ way, but he seems to be ok with the `with` way:
http://forum.dlang.org/post/oktru0$159b$1...@digitalmars.com
Walter didn't comment.
I think this has a good chance of getting in, but someone will have to
write a DIP and implement it.