On Friday 20 February 2015 13:37:16 Matthew Woehlke wrote: > On 2015-02-19 20:26, Thiago Macieira wrote: > > Do NOT do this. This will crash: > > for (auto const &item : std::cref(somefunction()) { ... } > > Does it crash without the std::cref?
No, due to lifetime extension of the temporary. > If not... seems like a good argument to support a free 'const'... > > > And another reason is that std::cref is a C++11 Standard Library addition > > and we cannot depend on that yet. > > ...but so is range-based for (and auto). That's different, those are core language features and we have Q_COMPILER_xxx for them. Standard Library features are more difficult to detect and even the library providers are lagging behind: https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.2011 -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development