Topic: Range-based for: emplace construction of the range expression?


Author: John Yates <john@yates-sheets.org>
Date: Thu, 1 Mar 2018 08:55:40 -0500
Raw View
--94eb2c0cf7b41eac6205665a37eb
Content-Type: text/plain; charset="UTF-8"

Recently I have written a class to be used as the range expression in
range-based for loops.  Buried 4 levels within my new class is a tiny leaf
object with RAII semantics.  I have been happily using that object
unchanged for years.

Now my new range class is causing me to have to add move semantics not only
to that tiny leaf class but also the 3 new classes layered above it.  As
best as I can tell this is triggered by the fact that throughout the
evolution of range-base for the expansion has always included
initialization the hidden range variable via assignment.  If the
range-expression is an invocation of a constructor then is there any reason
that the language could not mandate emplace construction?

/john

--
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAJnXXogM%3DQ_OUA2806gwbNtPiQ9f2G8KD49VOXteKB7UWKxUrw%40mail.gmail.com.

--94eb2c0cf7b41eac6205665a37eb
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:arial,he=
lvetica,sans-serif">Recently I have written a class to be used as the range=
 expression in range-based for loops.=C2=A0 Buried 4 levels within my new c=
lass is a tiny leaf object with RAII semantics.=C2=A0 I have been happily u=
sing that object unchanged for years.</div><div class=3D"gmail_default" sty=
le=3D"font-family:arial,helvetica,sans-serif"><br></div><div class=3D"gmail=
_default" style=3D"font-family:arial,helvetica,sans-serif">Now my new range=
 class is causing me to have to add move semantics not only to that tiny le=
af class but also the 3 new classes layered above it.=C2=A0 As best as I ca=
n tell this is triggered by the fact that throughout the evolution of range=
-base for the expansion has always included initialization the hidden range=
 variable via assignment.=C2=A0 If the range-expression is an invocation of=
 a constructor then is there any reason that the language could not mandate=
 emplace construction?</div><div class=3D"gmail_default" style=3D"font-fami=
ly:arial,helvetica,sans-serif"><br></div><div class=3D"gmail_default" style=
=3D"font-family:arial,helvetica,sans-serif">/john</div>
</div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAJnXXogM%3DQ_OUA2806gwbNtPiQ9f2G8KD4=
9VOXteKB7UWKxUrw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAJnXXogM%3DQ_O=
UA2806gwbNtPiQ9f2G8KD49VOXteKB7UWKxUrw%40mail.gmail.com</a>.<br />

--94eb2c0cf7b41eac6205665a37eb--

.