for (elem : range) { ... }
for (auto&& elem : range ) { ... }
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposal...@isocpp.org.
To post to this group, send email to std-pr...@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAOHCbitEG6uChd%3DD_TwE-h7e4Ekf_GaqJXH%3DqPN1a%3DqNJ6NbCA%40mail.gmail.com.
auto&& is trivial to understand and learn. What's the problem?
And unless you like extra '{}' around the loop, you have to allow the scoped syntax to avoid name pollution out of the loop in some cases, which are perhaps more common. (I also don't like raw do-while statement because it can't work in this way well.)
On Sat, Jul 30, 2016 at 10:56 AM, FrankHB1989 <frank...@gmail.com> wrote:And unless you like extra '{}' around the loop, you have to allow the scoped syntax to avoid name pollution out of the loop in some cases, which are perhaps more common. (I also don't like raw do-while statement because it can't work in this way well.)Speaking of which, I've been wondering why there was no while (type t = f(); t--) { /*...*/ } accepted alongside the if and switch versions coming in C++17.
I can only assume that it's because you can already do the same thing using for (type t = f(); t--; ) but then since we're already redundant, it wouldn't have hurt to add it for while too, surely?Also, for doesn't cover the same semantics as do, so we could also add that: do ( type t = f() ) { /*...*/ } while ( cond() );