[Development] Proposal: Deprecating platforms in Qt 5.6 that don't support lambda
Mark Gaiser
markg85 at gmail.com
Fri Feb 20 15:24:04 CET 2015
On Fri, Feb 20, 2015 at 2:26 AM, Thiago Macieira <thiago.macieira at intel.com>
wrote:
> On Friday 20 February 2015 00:17:00 Mathias Hasselmann wrote:
> > Use std::cref() if not sure about your container's constness.
> >
> > for (auto const& item : std::cref(c)) { ... }
>
> Do NOT do this. This will crash:
>
> for (auto const &item : std::cref(somefunction()) { ... }
>
> See my other email for an explanation.
>
> And another reason is that std::cref is a C++11 Standard Library addition
> and
> we cannot depend on that yet.
>
Disclaimer: i don't know a thing about the C++ committee and how they
handle papers. What follows might be completely irrelevant if the paper was
rejected. Do you know if it is?
I've read about this range-based-for stuff before and there was this paper
[1] that apparently wants to introduce the next generation of it. It would
introduce the syntax (WITHOUT auto!):
for (elem : range)
Which would be exactly the same as:
for (auto&& elem : range)
Now i wonder, even if that paper is accepted, would it solve the issue for
the Qt containers when that syntax would be used on them?
[1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3853.htm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20150220/2e1a1da9/attachment.html>
More information about the Development
mailing list