Topic: returned lambda with value captumove should be
Author: Mikhail Semenov <mikhailsemenov1957@gmail.com>
Date: Wed, 5 Jun 2013 03:18:39 -0700 (PDT)
Raw View
------=_Part_4768_567497.1370427519894
Content-Type: text/plain; charset=ISO-8859-1
I wonder if there is a chance to get it expicitly stated in the standard
that, in cases like the one below, the move constructor (or even higher
optimization, like re-use) should be used (not the copy constructor):
auto f()
{
double a[] = {0.1, 2.0, 3.5};
std::vector<double>v1(a,a+3);
return [v1](){ return v1; }; // use move (or re-use) not copy
}
I have noticed that some developers started writing their own captures,
which explicitly use move.
At the same time, some compilers (like Visual C++) already provide
optimization.
I think the users should not re-invent the wheel.
--
---
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-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.
------=_Part_4768_567497.1370427519894
Content-Type: text/html; charset=ISO-8859-1
<DIV>I wonder if there is a chance to get it expicitly stated in the standard that, in cases like the one below, the move constructor (or even higher optimization, like re-use) should be used (not the copy constructor):</DIV>
<DIV>auto f()<BR>{<BR> double a[] = {0.1, 2.0, 3.5};<BR> std::vector<double>v1(a,a+3);<BR> return [v1](){ return v1; }; // use move (or re-use) not copy<BR>}</DIV>
<DIV> </DIV>
<DIV>I have noticed that some developers started writing their own captures, which explicitly use move. </DIV>
<DIV>At the same time, some compilers (like Visual C++) already provide optimization. </DIV>
<DIV>I think the users should not re-invent the wheel.</DIV>
<DIV> </DIV>
<DIV> </DIV>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href="http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en">http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en</a>.<br />
<br />
<br />
------=_Part_4768_567497.1370427519894--
.