Topic: Reconstruct function idea


Author: Myriachan <myriachan@gmail.com>
Date: Wed, 15 Oct 2014 14:01:44 -0700 (PDT)
Raw View
------=_Part_1588_138264838.1413406904187
Content-Type: text/plain; charset=UTF-8

What about a library function called std::reconstruct or similar to destroy
and reconstruct an object in place?

template <typename T, typename... Args>
T &reconstruct(T &object, Args &&...args)
    noexcept(noexcept(T(std::declval<Args>()...)))
{
    object.~T();
    return *new(&object) T(std::forward<Args &&>(args)...);
}

// Alternatively:
extern const struct reconstruct_t { } reconstruct_x = { };

template <typename T>
inline void *operator new(std::size_t size, reconstruct_t, T &object)
{
    assert(size >= sizeof(T));
    object.~T();
    return &object;
}

int main()
{
    Meow meow("hi there", 4);
    reconstruct(meow, "reconstructed", -1);
    new(reconstruct_x, meow) Meow("re-newed", 8);
    return 0;
}


Melissa

--

---
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/.

------=_Part_1588_138264838.1413406904187
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">What about a library function called std::reconstruct or s=
imilar to destroy and reconstruct an object in place?<br><br><div class=3D"=
prettyprint" style=3D"background-color: rgb(250, 250, 250); border-color: r=
gb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: break=
-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">template</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">typename</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> T</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">typename</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">...</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #606;" class=3D"styled-by-prettify">Args</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br>T </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">reconstruct</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify">T </span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">&amp;</span><span style=3D"color: #008;" class=3D=
"styled-by-prettify">object</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">A=
rgs</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;&amp;...</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify">args</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; noexcept</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify">noexcept</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify">T</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify">std</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify">declval</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">&lt;</span><span style=3D"color: #606;" class=3D"styled-by-prettify"=
>Args</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;(=
)...)))</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br=
></span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; =
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">object</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">.~</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify">T</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">();</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">return</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">*</span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">new</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">(&amp;</span><span style=3D"color: #008;" class=3D"styled=
-by-prettify">object</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> T</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify">std</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify">forward</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #=
606;" class=3D"styled-by-prettify">Args</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">&amp;&amp;&gt;(</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify">args</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">)...);</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br><br></span><span style=3D"color: #800;" class=3D"styled-by-prettify">//=
 Alternatively:</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">e=
xtern</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">const</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> reconstruct_t </span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> reconstruct_x </span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">};</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">template</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">typename</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> T</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">inline</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">void</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">*</span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">operator</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">new</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify">std</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">size_t size</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> reconstruct_t</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> T </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp=
;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">object</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">assert</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify">size </span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">&gt;=3D</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"sty=
led-by-prettify">sizeof</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy">T</span><span style=3D"color: #660;" class=3D"styled-by-prettify">));</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &=
nbsp; </span><span style=3D"color: #008;" class=3D"styled-by-prettify">obje=
ct</span><span style=3D"color: #660;" class=3D"styled-by-prettify">.~</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify">T</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">();</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">return</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"color: #00=
8;" class=3D"styled-by-prettify">object</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">}</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"><br><br></span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">int</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> mai=
n</span><span style=3D"color: #660;" class=3D"styled-by-prettify">()</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span s=
tyle=3D"color: #606;" class=3D"styled-by-prettify">Meow</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> meow</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #08=
0;" class=3D"styled-by-prettify">"hi there"</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #066;" class=3D"style=
d-by-prettify">4</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><b=
r>&nbsp; &nbsp; reconstruct</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify">meow</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span style=3D"color: #080;" class=3D"styled-by-prettify">"reconstructed"<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">-</span><span style=3D"color=
: #066;" class=3D"styled-by-prettify">1</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">);</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"color: #008;" =
class=3D"styled-by-prettify">new</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">reconstruct_x</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> meow</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span style=3D"color: #606;" class=3D"styled-by-prettify">Meow</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=
=3D"color: #080;" class=3D"styled-by-prettify">"re-newed"</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #066;" =
class=3D"styled-by-prettify">8</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">);</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br>&nbsp; &nbsp; </span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">return</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-pre=
ttify">0</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"><br></span></div></code></=
div><br><br>Melissa<br></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_1588_138264838.1413406904187--

.


Author: Nevin Liber <nevin@eviloverlord.com>
Date: Wed, 15 Oct 2014 16:03:56 -0500
Raw View
--001a11c37d28b7654005057c7aa8
Content-Type: text/plain; charset=UTF-8

On 15 October 2014 16:01, Myriachan <myriachan@gmail.com> wrote:

> What about a library function called std::reconstruct or similar to
> destroy and reconstruct an object in place?
>

It's called std::experimental::optional.
--
 Nevin ":-)" Liber  <mailto:nevin@eviloverlord.com>  (847) 691-1404

--

---
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/.

--001a11c37d28b7654005057c7aa8
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On 15 October 2014 16:01, Myriachan <span dir=3D"ltr">&lt;=
<a href=3D"mailto:myriachan@gmail.com" target=3D"_blank">myriachan@gmail.co=
m</a>&gt;</span> wrote:<br><div class=3D"gmail_extra"><div class=3D"gmail_q=
uote"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-l=
eft:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">What about a library =
function called std::reconstruct or similar to destroy and reconstruct an o=
bject in place?<br></div></blockquote><div><br></div><div>It&#39;s called s=
td::experimental::optional.</div></div>-- <br>=C2=A0Nevin &quot;:-)&quot; L=
iber=C2=A0 &lt;mailto:<a href=3D"mailto:nevin@eviloverlord.com" target=3D"_=
blank">nevin@eviloverlord.com</a>&gt;=C2=A0 (847) 691-1404
</div></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--001a11c37d28b7654005057c7aa8--

.


Author: Myriachan <myriachan@gmail.com>
Date: Wed, 15 Oct 2014 14:17:54 -0700 (PDT)
Raw View
------=_Part_5533_1128287717.1413407875193
Content-Type: text/plain; charset=UTF-8

On Wednesday, October 15, 2014 2:04:38 PM UTC-7, Nevin ":-)" Liber wrote:
>
> On 15 October 2014 16:01, Myriachan <myri...@gmail.com <javascript:>>
> wrote:
>
>> What about a library function called std::reconstruct or similar to
>> destroy and reconstruct an object in place?
>>
>
> It's called std::experimental::optional.
> --
>  Nevin ":-)" Liber  <mailto:ne...@eviloverlord.com <javascript:>>  (847)
> 691-1404
>

While that is a nice feature, it's not the same as needing to do this to
types that weren't created as std::optional<T>.

Melissa

--

---
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/.

------=_Part_5533_1128287717.1413407875193
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Wednesday, October 15, 2014 2:04:38 PM UTC-7, Nevin ":-=
)" Liber wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-=
left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr=
">On 15 October 2014 16:01, Myriachan <span dir=3D"ltr">&lt;<a href=3D"java=
script:" target=3D"_blank" gdf-obfuscated-mailto=3D"i4a02d810LAJ" onmousedo=
wn=3D"this.href=3D'javascript:';return true;" onclick=3D"this.href=3D'javas=
cript:';return true;">myri...@gmail.com</a>&gt;</span> wrote:<br><div><div =
class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0 0=
 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">What =
about a library function called std::reconstruct or similar to destroy and =
reconstruct an object in place?<br></div></blockquote><div><br></div><div>I=
t's called std::experimental::optional.</div></div>-- <br>&nbsp;Nevin ":-)"=
 Liber&nbsp; &lt;mailto:<a href=3D"javascript:" target=3D"_blank" gdf-obfus=
cated-mailto=3D"i4a02d810LAJ" onmousedown=3D"this.href=3D'javascript:';retu=
rn true;" onclick=3D"this.href=3D'javascript:';return true;">ne...@evilover=
lord.com</a><wbr>&gt;&nbsp; (847) 691-1404
</div></div></blockquote><div><br>While that is a nice feature, it's not th=
e same as needing to do this to types that weren't created as <span style=
=3D"font-family: courier new,monospace;">std::optional&lt;T&gt;</span>. <br=
><br>Melissa<br></div></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_5533_1128287717.1413407875193--

.


Author: Nevin Liber <nevin@eviloverlord.com>
Date: Wed, 15 Oct 2014 16:47:29 -0500
Raw View
--f46d043890877e47c305057d168b
Content-Type: text/plain; charset=UTF-8

On 15 October 2014 16:17, Myriachan <myriachan@gmail.com> wrote:

> While that is a nice feature, it's not the same as needing to do this to
> types that weren't created as std::optional<T>.
>

It is also *extremely* unsafe to do it with any class that can throw an
exception during construction or destruction.  Why would we want to
encourage such a bad habit?  I would vote strongly against such a
proposal.  Even if you SFINAEed it so that it only worked with constructors
and destructors marked noexcept, I'd still vote against it, as 99% of users
should never use such a function.


--
 Nevin ":-)" Liber  <mailto:nevin@eviloverlord.com>  (847) 691-1404

--

---
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/.

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

<div dir=3D"ltr"><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">=
On 15 October 2014 16:17, Myriachan <span dir=3D"ltr">&lt;<a href=3D"mailto=
:myriachan@gmail.com" target=3D"_blank">myriachan@gmail.com</a>&gt;</span> =
wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bord=
er-left:1px #ccc solid;padding-left:1ex"><div>While that is a nice feature,=
 it&#39;s not the same as needing to do this to types that weren&#39;t crea=
ted as <span style=3D"font-family:courier new,monospace">std::optional&lt;T=
&gt;</span>. <br></div></blockquote></div><br>It is also <i>extremely</i>=
=C2=A0unsafe to do it with any class that can throw an exception during con=
struction or destruction.=C2=A0 Why would we want to encourage such a bad h=
abit?=C2=A0 I would vote strongly against such a proposal.=C2=A0 Even if yo=
u SFINAEed it so that it only worked with constructors and destructors mark=
ed noexcept, I&#39;d still vote against it, as 99% of users should never us=
e such a function.<br><br clear=3D"all"><div><br></div>-- <br>=C2=A0Nevin &=
quot;:-)&quot; Liber=C2=A0 &lt;mailto:<a href=3D"mailto:nevin@eviloverlord.=
com" target=3D"_blank">nevin@eviloverlord.com</a>&gt;=C2=A0 (847) 691-1404
</div></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--f46d043890877e47c305057d168b--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Thu, 16 Oct 2014 01:02:26 +0300
Raw View
On 16 October 2014 00:17, Myriachan <myriachan@gmail.com> wrote:
>> It's called std::experimental::optional.
> While that is a nice feature, it's not the same as needing to do this to
> types that weren't created as std::optional<T>.


Some questions:

1) if you can refactor code to take into use this reconstruction
function, do you
think you can't change the same code to start using optional? If so, why?

2) do you think this function is important and common enough to standardize it,
and if so, based on what(*)?

(*) I'm looking for more than anecdotes here, because if you say "I use such
a thing every day", I will respond "whereas I never use such things,
so let's call
it a push". ;)

--

---
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/.

.


Author: Myriachan <myriachan@gmail.com>
Date: Wed, 15 Oct 2014 15:22:53 -0700 (PDT)
Raw View
------=_Part_5730_1346458005.1413411773510
Content-Type: text/plain; charset=UTF-8

On Wednesday, October 15, 2014 3:02:28 PM UTC-7, Ville Voutilainen wrote:
>
> On 16 October 2014 00:17, Myriachan <myri...@gmail.com <javascript:>>
> wrote:
> >> It's called std::experimental::optional.
> > While that is a nice feature, it's not the same as needing to do this to
> > types that weren't created as std::optional<T>.
>
>
> Some questions:
>
> 1) if you can refactor code to take into use this reconstruction
> function, do you
> think you can't change the same code to start using optional? If so, why?
>
>
The main reason to use something like this is for copy constructors.
Sometimes, the most convenient way to implement a copy or move constructor
is like this:

T &T::operator =(const T &copy)
{
    if (&copy != this)
    {
        this->~T();
        new(this) T(copy);
    }
    return *this;
}

....and equivalently with std::forward for move constructors.


2) do you think this function is important and common enough to standardize
> it,
> and if so, based on what(*)?
>
> (*) I'm looking for more than anecdotes here, because if you say "I use
> such
> a thing every day", I will respond "whereas I never use such things,
> so let's call
> it a push". ;)
>

After thinking more deeply about the exception implications, prompted by
Nevin's reply, I can see how this is quite dangerous, since there's no way
to stop a local destructor from executing.  I just saw it as shorthand for
what people do already.

Melissa

--

---
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/.

------=_Part_5730_1346458005.1413411773510
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Wednesday, October 15, 2014 3:02:28 PM UTC-7, Ville Vou=
tilainen wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-=
left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On 16 October 2=
014 00:17, Myriachan &lt;<a href=3D"javascript:" target=3D"_blank" gdf-obfu=
scated-mailto=3D"fbazzRHkyrUJ" onmousedown=3D"this.href=3D'javascript:';ret=
urn true;" onclick=3D"this.href=3D'javascript:';return true;">myri...@gmail=
..com</a>&gt; wrote:
<br>&gt;&gt; It's called std::experimental::optional.
<br>&gt; While that is a nice feature, it's not the same as needing to do t=
his to
<br>&gt; types that weren't created as std::optional&lt;T&gt;.
<br>
<br>
<br>Some questions:
<br>
<br>1) if you can refactor code to take into use this reconstruction
<br>function, do you
<br>think you can't change the same code to start using optional? If so, wh=
y?
<br>
<br></blockquote><div><br>The main reason to use something like this is for=
 copy constructors.&nbsp; Sometimes, the most convenient way to implement a=
 copy or move constructor is like this:<br><br><div class=3D"prettyprint" s=
tyle=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 1=
87); border-style: solid; border-width: 1px; word-wrap: break-word;"><code =
class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #=
000;" class=3D"styled-by-prettify">T </span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">&amp;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">T</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">::</span><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">operator</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D(=
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">const</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> T </span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify">copy</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">if</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">(&amp;</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify">copy </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
!=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </spa=
n><span style=3D"color: #008;" class=3D"styled-by-prettify">this</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; &nbsp; &nb=
sp; </span><span style=3D"color: #008;" class=3D"styled-by-prettify">this</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">-&gt;~</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify">T</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">();</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; &nbsp; &nbsp; =
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">new</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">this</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> T</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify">copy</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">);</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br>&nbsp; &nbsp; </span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"><br>&nbsp; &nbsp; </span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">return</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">*</=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">this</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">}</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br></span></div></code></div><br>...and e=
quivalently with std::forward for move constructors.<br><br><br></div><bloc=
kquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-l=
eft: 1px #ccc solid;padding-left: 1ex;">2) do you think this function is im=
portant and common enough to standardize it,
<br>and if so, based on what(*)?
<br>
<br>(*) I'm looking for more than anecdotes here, because if you say "I use=
 such
<br>a thing every day", I will respond "whereas I never use such things,
<br>so let's call
<br>it a push". ;)
<br></blockquote><div><br>After thinking more deeply about the exception im=
plications, prompted by Nevin's reply, I can see how this is quite dangerou=
s, since there's no way to stop a local destructor from executing.&nbsp; I =
just saw it as shorthand for what people do already. <br><br>Melissa<br></d=
iv></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_5730_1346458005.1413411773510--

.


Author: Miro Knejp <miro.knejp@gmail.com>
Date: Thu, 16 Oct 2014 00:31:34 +0200
Raw View
--Apple-Mail=_E13665DB-02DB-4780-A11D-E6BA09991BF3
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=ISO-8859-1


On 16 Oct 2014, at 00:22 , Myriachan <myriachan@gmail.com> wrote:

> On Wednesday, October 15, 2014 3:02:28 PM UTC-7, Ville Voutilainen wrote:
> On 16 October 2014 00:17, Myriachan <myri...@gmail.com> wrote:=20
> >> It's called std::experimental::optional.=20
> > While that is a nice feature, it's not the same as needing to do this t=
o=20
> > types that weren't created as std::optional<T>.=20
>=20
>=20
> Some questions:=20
>=20
> 1) if you can refactor code to take into use this reconstruction=20
> function, do you=20
> think you can't change the same code to start using optional? If so, why?=
=20
>=20
>=20
> The main reason to use something like this is for copy constructors.  Som=
etimes, the most convenient way to implement a copy or move constructor is =
like this:
>=20
> T &T::operator =3D(const T &copy)
> {
>     if (&copy !=3D this)
>     {
>         this->~T();
>         new(this) T(copy);
>     }
>     return *this;
> }
>=20
> ...and equivalently with std::forward for move constructors.

This would never pass my code review. If that constructor throws you're doo=
med. Use copy-and-swap instead, it provides strong exception guarantee and =
won't leave you with a destroyed object. Move constructors are a different =
game though and the compiler-defaulted one should do it's job just fine in =
most cases.

T& T::operator =3D(const T& copy)
{
    if (&copy !=3D this)
    {
        T x{copy};
        swap(*this, x);
    }
    return *this;
}

--=20

---=20
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 e=
mail 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-proposa=
ls/.

--Apple-Mail=_E13665DB-02DB-4780-A11D-E6BA09991BF3
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dus-ascii"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode=
: space; -webkit-line-break: after-white-space;"><br><div><div>On 16 Oct 20=
14, at 00:22 , Myriachan &lt;<a href=3D"mailto:myriachan@gmail.com">myriach=
an@gmail.com</a>&gt; wrote:</div><br class=3D"Apple-interchange-newline"><b=
lockquote type=3D"cite"><div dir=3D"ltr">On Wednesday, October 15, 2014 3:0=
2:28 PM UTC-7, Ville Voutilainen wrote:<blockquote class=3D"gmail_quote" st=
yle=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-lef=
t: 1ex;">On 16 October 2014 00:17, Myriachan &lt;<a href=3D"javascript:" ta=
rget=3D"_blank" gdf-obfuscated-mailto=3D"fbazzRHkyrUJ" onmousedown=3D"this.=
href=3D'javascript:';return true;" onclick=3D"this.href=3D'javascript:';ret=
urn true;">myri...@gmail.com</a>&gt; wrote:
<br>&gt;&gt; It's called std::experimental::optional.
<br>&gt; While that is a nice feature, it's not the same as needing to do t=
his to
<br>&gt; types that weren't created as std::optional&lt;T&gt;.
<br>
<br>
<br>Some questions:
<br>
<br>1) if you can refactor code to take into use this reconstruction
<br>function, do you
<br>think you can't change the same code to start using optional? If so, wh=
y?
<br>
<br></blockquote><div><br>The main reason to use something like this is for=
 copy constructors.&nbsp; Sometimes, the most convenient way to implement a=
 copy or move constructor is like this:<br><br><div class=3D"prettyprint" s=
tyle=3D"background-color: rgb(250, 250, 250); border: 1px solid rgb(187, 18=
7, 187); word-wrap: break-word; position: static; z-index: auto;"><code cla=
ss=3D"prettyprint">T <span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">&amp;</span>T<span style=3D"color: #660;" class=3D"styled-by-prettify">=
::</span><span style=3D"color: #008;" class=3D"styled-by-prettify">operator=
</span> <span style=3D"color: #660;" class=3D"styled-by-prettify">=3D(</spa=
n><span style=3D"color: #008;" class=3D"styled-by-prettify">const</span> T =
<span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span>copy<=
span style=3D"color: #660;" class=3D"styled-by-prettify">)</span><br><span =
style=3D"color: #660;" class=3D"styled-by-prettify">{</span><br>&nbsp; &nbs=
p; <span style=3D"color: #008;" class=3D"styled-by-prettify">if</span> <spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">(&amp;</span>copy <sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">!=3D</span> <span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">this</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">)</span><br>&nbsp; &nbsp; <span=
 style=3D"color: #660;" class=3D"styled-by-prettify">{</span><br>&nbsp; &nb=
sp; &nbsp; &nbsp; <span style=3D"color: #008;" class=3D"styled-by-prettify"=
>this</span><span style=3D"color: #660;" class=3D"styled-by-prettify">-&gt;=
~</span>T<span style=3D"color: #660;" class=3D"styled-by-prettify">();</spa=
n><br>&nbsp; &nbsp; &nbsp; &nbsp; <span style=3D"color: #008;" class=3D"sty=
led-by-prettify">new</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>this</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)</sp=
an> T<span style=3D"color: #660;" class=3D"styled-by-prettify">(</span>copy=
<span style=3D"color: #660;" class=3D"styled-by-prettify">);</span><br>&nbs=
p; &nbsp; <span style=3D"color: #660;" class=3D"styled-by-prettify">}</span=
><br>&nbsp; &nbsp; <span style=3D"color: #008;" class=3D"styled-by-prettify=
">return</span> <span style=3D"color: #660;" class=3D"styled-by-prettify">*=
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">this</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><br><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">}</span><br></code></=
div><br>...and equivalently with std::forward for move constructors.<br></d=
iv></div></blockquote><div><br></div>This would never pass my code review. =
If that constructor throws you're doomed. Use copy-and-swap instead, it pro=
vides strong exception guarantee and won't leave you with a destroyed objec=
t. Move constructors are a different game though and the compiler-defaulted=
 one should do it's job just fine in most cases.</div><div><br></div><div><=
div dir=3D"ltr"><div class=3D"prettyprint" style=3D"background-color: rgb(2=
50, 250, 250); border: 1px solid rgb(187, 187, 187); word-wrap: break-word;=
 position: static; z-index: auto;"><code class=3D"prettyprint">T<span class=
=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">&amp;&nbsp;</spa=
n>T<span class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">::=
</span><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 136);">=
operator</span>&nbsp;<span class=3D"styled-by-prettify" style=3D"color: rgb=
(102, 102, 0);">=3D(</span><span class=3D"styled-by-prettify" style=3D"colo=
r: rgb(0, 0, 136);">const</span>&nbsp;T<span class=3D"styled-by-prettify" s=
tyle=3D"color: rgb(102, 102, 0);">&amp;&nbsp;</span>copy<span class=3D"styl=
ed-by-prettify" style=3D"color: rgb(102, 102, 0);">)</span><br><span class=
=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">{</span><br>&nbs=
p; &nbsp;&nbsp;<span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0,=
 136);">if</span>&nbsp;<span class=3D"styled-by-prettify" style=3D"color: r=
gb(102, 102, 0);">(&amp;</span>copy&nbsp;<span class=3D"styled-by-prettify"=
 style=3D"color: rgb(102, 102, 0);">!=3D</span>&nbsp;<span class=3D"styled-=
by-prettify" style=3D"color: rgb(0, 0, 136);">this</span><span class=3D"sty=
led-by-prettify" style=3D"color: rgb(102, 102, 0);">)</span><br>&nbsp; &nbs=
p;&nbsp;<span class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0)=
;">{</span><br>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;T x<span class=3D"styled-by=
-prettify" style=3D"color: rgb(102, 102, 0);">{copy};</span><br>&nbsp; &nbs=
p; &nbsp; &nbsp;&nbsp;<span class=3D"styled-by-prettify" style=3D"color: rg=
b(0, 0, 136);">swap</span><span class=3D"styled-by-prettify" style=3D"color=
: rgb(102, 102, 0);">(*</span><span class=3D"styled-by-prettify" style=3D"c=
olor: rgb(0, 0, 136);">this</span><span class=3D"styled-by-prettify"><font =
color=3D"#666600">,&nbsp;</font></span>x<span class=3D"styled-by-prettify" =
style=3D"color: rgb(102, 102, 0);">);</span><br>&nbsp; &nbsp;&nbsp;<span cl=
ass=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">}</span><br>&=
nbsp; &nbsp;&nbsp;<span class=3D"styled-by-prettify" style=3D"color: rgb(0,=
 0, 136);">return</span>&nbsp;<span class=3D"styled-by-prettify" style=3D"c=
olor: rgb(102, 102, 0);">*</span><span class=3D"styled-by-prettify" style=
=3D"color: rgb(0, 0, 136);">this</span><span class=3D"styled-by-prettify" s=
tyle=3D"color: rgb(102, 102, 0);">;</span><br><span class=3D"styled-by-pret=
tify" style=3D"color: rgb(102, 102, 0);">}</span><br></code></div></div><di=
v></div></div><br></body></html>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--Apple-Mail=_E13665DB-02DB-4780-A11D-E6BA09991BF3--

.


Author: Myriachan <myriachan@gmail.com>
Date: Wed, 15 Oct 2014 19:03:00 -0700 (PDT)
Raw View
------=_Part_123_1538419150.1413424980736
Content-Type: text/plain; charset=UTF-8

On Wednesday, October 15, 2014 3:31:39 PM UTC-7, Miro Knejp wrote:
>
> On 16 Oct 2014, at 00:22 , Myriachan <myri...@gmail.com <javascript:>>
> wrote:
>
> The main reason to use something like this is for copy constructors.
> Sometimes, the most convenient way to implement a copy or move constructor
> is like this:
>
> T &T::operator =(const T &copy)
> {
>     if (&copy != this)
>     {
>         this->~T();
>         new(this) T(copy);
>     }
>     return *this;
> }
>
> ...and equivalently with std::forward for move constructors.
>
>
> This would never pass my code review. If that constructor throws you're
> doomed. Use copy-and-swap instead, it provides strong exception guarantee
> and won't leave you with a destroyed object. Move constructors are a
> different game though and the compiler-defaulted one should do it's job
> just fine in most cases.
>
> T& T::operator =(const T& copy)
> {
>     if (&copy != this)
>     {
>         T x{copy};
>         swap(*this, x);
>     }
>     return *this;
> }
>
>
I suppose the difference is that I work on a project that disables C++
exceptions because they're too slow.  swap would be slow or unusable if
there's either no overload for it nor move constructors, which for a
codebase of millions of lines written before C++11 is likely.

Enabling C++ exception handling is a massive performance decrease in x86-32
Windows.  If it's enabled in the compiler, even if no exceptions are used,
every function with an automatic variable whose type has a destructor will
be ~20 instructions longer due to setting up the exception frame.

Melissa

--

---
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/.

------=_Part_123_1538419150.1413424980736
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Wednesday, October 15, 2014 3:31:39 PM UTC-7, Miro Knej=
p wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0=
..8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div style=3D"word-wra=
p:break-word"><div><div>On 16 Oct 2014, at 00:22 , Myriachan &lt;<a href=3D=
"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"c9vIXik38_QJ" onmo=
usedown=3D"this.href=3D'javascript:';return true;" onclick=3D"this.href=3D'=
javascript:';return true;">myri...@gmail.com</a>&gt; wrote:</div><blockquot=
e type=3D"cite"><div dir=3D"ltr">The main reason to use something like this=
 is for copy constructors.&nbsp; Sometimes, the most convenient way to impl=
ement a copy or move constructor is like this:<br><div><br><div style=3D"ba=
ckground-color:rgb(250,250,250);border:1px solid rgb(187,187,187);word-wrap=
:break-word"><code>T <span style=3D"color:#660">&amp;</span>T<span style=3D=
"color:#660">::</span><span style=3D"color:#008">operator</span> <span styl=
e=3D"color:#660">=3D(</span><span style=3D"color:#008">const</span> T <span=
 style=3D"color:#660">&amp;</span>copy<span style=3D"color:#660">)</span><b=
r><span style=3D"color:#660">{</span><br>&nbsp; &nbsp; <span style=3D"color=
:#008">if</span> <span style=3D"color:#660">(&amp;</span>copy <span style=
=3D"color:#660">!=3D</span> <span style=3D"color:#008">this</span><span sty=
le=3D"color:#660">)</span><br>&nbsp; &nbsp; <span style=3D"color:#660">{</s=
pan><br>&nbsp; &nbsp; &nbsp; &nbsp; <span style=3D"color:#008">this</span><=
span style=3D"color:#660">-&gt;~</span>T<span style=3D"color:#660">();</spa=
n><br>&nbsp; &nbsp; &nbsp; &nbsp; <span style=3D"color:#008">new</span><spa=
n style=3D"color:#660">(</span><span style=3D"color:#008">this</span><span =
style=3D"color:#660">)</span> T<span style=3D"color:#660">(</span>copy<span=
 style=3D"color:#660">);</span><br>&nbsp; &nbsp; <span style=3D"color:#660"=
>}</span><br>&nbsp; &nbsp; <span style=3D"color:#008">return</span> <span s=
tyle=3D"color:#660">*</span><span style=3D"color:#008">this</span><span sty=
le=3D"color:#660">;</span><br><span style=3D"color:#660">}</span><br></code=
></div><br>...and equivalently with std::forward for move constructors.<br>=
</div></div></blockquote><div><br></div>This would never pass my code revie=
w. If that constructor throws you're doomed. Use copy-and-swap instead, it =
provides strong exception guarantee and won't leave you with a destroyed ob=
ject. Move constructors are a different game though and the compiler-defaul=
ted one should do it's job just fine in most cases.</div><div><br></div><di=
v><div dir=3D"ltr"><div style=3D"background-color:rgb(250,250,250);border:1=
px solid rgb(187,187,187);word-wrap:break-word"><code>T<span style=3D"color=
:rgb(102,102,0)">&amp;&nbsp;</span>T<span style=3D"color:rgb(102,102,0)">::=
</span><span style=3D"color:rgb(0,0,136)">operator</span>&nbsp;<span style=
=3D"color:rgb(102,102,0)">=3D(</span><span style=3D"color:rgb(0,0,136)">con=
st</span>&nbsp;T<span style=3D"color:rgb(102,102,0)">&amp;&nbsp;</span>copy=
<span style=3D"color:rgb(102,102,0)"><wbr>)</span><br><span style=3D"color:=
rgb(102,102,0)">{</span><br>&nbsp; &nbsp;&nbsp;<span style=3D"color:rgb(0,0=
,136)">if</span>&nbsp;<span style=3D"color:rgb(102,102,0)">(&amp;</span>cop=
y&nbsp;<span style=3D"color:rgb(102,102,0)">!=3D</span>&nbsp;<span style=3D=
"color:rgb(0,0,136)">this</span><span style=3D"color:rgb(102,102,0)">)</spa=
n><br>&nbsp; &nbsp;&nbsp;<span style=3D"color:rgb(102,102,0)">{</span><br>&=
nbsp; &nbsp; &nbsp; &nbsp;&nbsp;T x<span style=3D"color:rgb(102,102,0)">{co=
py};</span><br>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style=3D"color:rgb(0,=
0,136)">swap</span><span style=3D"color:rgb(102,102,0)">(*</span><span styl=
e=3D"color:rgb(0,0,136)">this</span><span><font color=3D"#666600">,&nbsp;</=
font></span>x<span style=3D"color:rgb(102,102,0)">);</span><br>&nbsp; &nbsp=
;&nbsp;<span style=3D"color:rgb(102,102,0)">}</span><br>&nbsp; &nbsp;&nbsp;=
<span style=3D"color:rgb(0,0,136)">return</span>&nbsp;<span style=3D"color:=
rgb(102,102,0)">*</span><span style=3D"color:rgb(0,0,136)">this</span><span=
 style=3D"color:rgb(102,102,0)">;</span><br><span style=3D"color:rgb(102,10=
2,0)">}</span><br></code></div></div><div></div></div><br></div></blockquot=
e><div><br>I suppose the difference is that I work on a project that disabl=
es C++ exceptions because they're too slow.&nbsp; swap would be slow or unu=
sable if there's either no overload for it nor move constructors, which for=
 a codebase of millions of lines written before C++11 is likely.<br><br>Ena=
bling C++ exception handling is a massive performance decrease in x86-32 Wi=
ndows.&nbsp; If it's enabled in the compiler, even if no exceptions are use=
d, every function with an automatic variable whose type has a destructor wi=
ll be ~20 instructions longer due to setting up the exception frame.<br><br=
>Melissa<br></div></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_123_1538419150.1413424980736--

.


Author: TONGARI J <tongari95@gmail.com>
Date: Wed, 15 Oct 2014 19:51:56 -0700 (PDT)
Raw View
------=_Part_4471_1540226158.1413427916083
Content-Type: text/plain; charset=UTF-8

On Thursday, October 16, 2014 5:48:11 AM UTC+8, Nevin ":-)" Liber wrote:
>
>
> On 15 October 2014 16:17, Myriachan <myri...@gmail.com <javascript:>>
> wrote:
>
>> While that is a nice feature, it's not the same as needing to do this to
>> types that weren't created as std::optional<T>.
>>
>
> It is also *extremely* unsafe to do it with any class that can throw an
> exception during construction or destruction.
>

How about this implementation? Is it unsafe?

template<unsigned N>
struct priority : priority<N - 1> {};


template<>
struct priority<0> {};


template<class T, class... As>
std::enable_if_t<std::is_nothrow_constructible<T, As...>::value && std::
is_nothrow_destructible<T>::value>
reconstruct_impl(priority<2>, T& t, As&&... as) noexcept
{
    t.~T();
    new(&t) T(std::forward<As>(as)...);
}


template<class T, class... As>
std::enable_if_t<std::is_nothrow_move_constructible<T>::value && std::
is_nothrow_destructible<T>::value>
reconstruct_impl(priority<1>, T& t, As&&... as)
{
    T tmp(std::forward<As>(as)...);
    t.~T();
    new(&t) T(std::move(tmp));
}


template<class T, class... As>
void reconstruct_impl(priority<0>, T& t, As&&... as)
{
    using std::swap;
    T tmp(std::forward<As>(as)...);
    swap(t, tmp);
}


template<class T, class... As>
void reconstruct(T& t, As&&... as) noexcept(std::is_nothrow_constructible<T,
As...>::value && std::is_nothrow_destructible<T>::value)
{
    reconstruct_impl(priority<2>{}, t, std::forward<As>(as)...);
}

The worst case fallbacks to copy-and-swap.

--

---
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/.

------=_Part_4471_1540226158.1413427916083
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Thursday, October 16, 2014 5:48:11 AM UTC+8, Nevin ":-)=
" Liber wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-l=
eft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"=
><div><br><div class=3D"gmail_quote">On 15 October 2014 16:17, Myriachan <s=
pan dir=3D"ltr">&lt;<a href=3D"javascript:" target=3D"_blank" gdf-obfuscate=
d-mailto=3D"bRh48Qt7Np8J" onmousedown=3D"this.href=3D'javascript:';return t=
rue;" onclick=3D"this.href=3D'javascript:';return true;">myri...@gmail.com<=
/a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:=
0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>While that is =
a nice feature, it's not the same as needing to do this to types that weren=
't created as <span style=3D"font-family:courier new,monospace">std::option=
al&lt;T&gt;</span>. <br></div></blockquote></div><br>It is also <i>extremel=
y</i>&nbsp;unsafe to do it with any class that can throw an exception durin=
g construction or destruction.</div></div></blockquote><div><br></div><div>=
How about this implementation? Is it unsafe?&nbsp;</div><div><br></div><div=
 class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); word-=
wrap: break-word; background-color: rgb(250, 250, 250);"><code class=3D"pre=
ttyprint"><div class=3D"subprettyprint"><span style=3D"color: #008;" class=
=3D"styled-by-prettify">template</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">unsigned</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> N</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">stru=
ct</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> priorit=
y </span><span style=3D"color: #660;" class=3D"styled-by-prettify">:</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> priority</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify">N </span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">-</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #066;" clas=
s=3D"styled-by-prettify">1</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>{};</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><b=
r><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">temp=
late</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&g=
t;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> priority</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span st=
yle=3D"color: #066;" class=3D"styled-by-prettify">0</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">{};</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br><br><br></span><span style=3D"color: #008;" class=3D=
"styled-by-prettify">template</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"styled-=
by-prettify">class</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> T</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">class</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">...</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #606;" class=3D"styled-by-prettify">As</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>std</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify">enable_if_t</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify">std</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">is_noth=
row_constructible</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
>T</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span sty=
le=3D"color: #606;" class=3D"styled-by-prettify">As</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">...&gt;::</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify">value </span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">&amp;&amp;</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> std</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">is_nothrow_destructible</span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify">T</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&gt;::</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify">value</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br>reconstruct_impl</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify">priority</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">&lt;</span><span style=3D"color: #066;" class=3D"styled-by-prettify=
">2</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;,</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> T</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> t</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=
=3D"styled-by-prettify">As</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">&amp;&amp;...</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">as</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> noexce=
pt<br></span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &n=
bsp; t</span><span style=3D"color: #660;" class=3D"styled-by-prettify">.~</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify">T</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">();</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">new</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">(&amp;</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify">t</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> T</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify">std</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">forwar=
d</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</spa=
n><span style=3D"color: #606;" class=3D"styled-by-prettify">As</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">&gt;(</span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">as</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">)...);</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br><br><br></span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">template</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">class</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> T</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">class</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">...</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #606;" class=3D"styled-by-prettify">As</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br>std</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">enable_if_t</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify">std</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">is_n=
othrow_move_constructible</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify">T</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
&gt;::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">valu=
e </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;&am=
p;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> std</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify">is_nothrow_destructibl=
e</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify">T</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">&gt;::</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">value</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">&gt;</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"><br>reconstruct_impl</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify">priority</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #066;"=
 class=3D"styled-by-prettify">1</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">&gt;,</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> T</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">&amp;</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> t</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span =
style=3D"color: #606;" class=3D"styled-by-prettify">As</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">&amp;&amp;...</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">as</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br>&nbsp; &nbsp; T tmp</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify">std</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">forwa=
rd</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</sp=
an><span style=3D"color: #606;" class=3D"styled-by-prettify">As</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">&gt;(</span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">as</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">)...);</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; t</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">.~</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">T</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">();</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">new</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">(&amp;</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify">t</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> T</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify">std</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">move</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify">tmp</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">));</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br><br><br></span><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">template</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">cla=
ss</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> T</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">class</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">...</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"=
styled-by-prettify">As</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">=
void</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> recon=
struct_impl</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">priority=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span=
><span style=3D"color: #066;" class=3D"styled-by-prettify">0</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">&gt;,</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> T</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> t</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-pr=
ettify">As</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
&amp;&amp;...</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">as</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">using</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> std</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify">swap</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br>&nbsp; &nbsp; T tmp</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify">std</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy">forward</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>&lt;</span><span style=3D"color: #606;" class=3D"styled-by-prettify">As</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;(</span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">as</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">)...);</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; swap</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify">t</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> tmp</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">);</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br><br><br></span><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">template</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">cla=
ss</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> T</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">class</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">...</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"=
styled-by-prettify">As</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">=
void</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> recon=
struct</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify">T</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> t</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=
=3D"styled-by-prettify">As</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">&amp;&amp;...</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">as</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> noexce=
pt</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify">std</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify">is_nothrow_constructible</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify">T</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=
=3D"styled-by-prettify">As</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">...&gt;::</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">value </span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">&amp;&amp;</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> std</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">is_=
nothrow_destructible</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy">T</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;:=
:</span><span style=3D"color: #000;" class=3D"styled-by-prettify">value</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; reconstruct_impl</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify">priority</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=
=3D"color: #066;" class=3D"styled-by-prettify">2</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">&gt;{},</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> t</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> std</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy">forward</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>&lt;</span><span style=3D"color: #606;" class=3D"styled-by-prettify">As</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;(</span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">as</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">)...);</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">}</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> </span></div></code></div><div><br></div><=
div>The worst case fallbacks to copy-and-swap.</div></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_4471_1540226158.1413427916083--

.


Author: Markus Grech <markus.grech@gmail.com>
Date: Wed, 15 Oct 2014 23:40:26 -0700 (PDT)
Raw View
------=_Part_6212_1650549670.1413441627011
Content-Type: text/plain; charset=UTF-8

I'm very surprised that nobody here knows how to write copy&swap correctly.
T& operator =(T rhs)
{
    swap(rhs);
    return *this;
}


--

---
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/.

------=_Part_6212_1650549670.1413441627011
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I'm very surprised that nobody here knows how to write cop=
y&amp;swap correctly.<div><div class=3D"prettyprint" style=3D"border: 1px s=
olid rgb(187, 187, 187); word-wrap: break-word; background-color: rgb(250, =
250, 250);"><code class=3D"prettyprint"><div class=3D"subprettyprint"><font=
 color=3D"#660066"><span style=3D"color: #000;" class=3D"styled-by-prettify=
">T</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">operator</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">=3D(</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify">T rhs</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br>&nbsp; &nbsp; swap</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">rhs</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br=
></span></font><span style=3D"color: rgb(0, 0, 0);"><span style=3D"color: #=
000;" class=3D"styled-by-prettify">&nbsp; &nbsp; </span><span style=3D"colo=
r: #008;" class=3D"styled-by-prettify">return</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">*</span><span style=3D"color: #008;" class=3D"sty=
led-by-prettify">this</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">;</span></span><font color=3D"#660066"><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br></span></font></div></code></div><br><br></div></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_6212_1650549670.1413441627011--

.


Author: Richard Smith <richard@metafoo.co.uk>
Date: Thu, 16 Oct 2014 13:16:27 -0700
Raw View
--001a11c1a2365b849e05058fece8
Content-Type: text/plain; charset=UTF-8

On Wed, Oct 15, 2014 at 11:40 PM, Markus Grech <markus.grech@gmail.com>
wrote:

> I'm very surprised that nobody here knows how to write copy&swap correctly.
> T& operator =(T rhs)
> {
>     swap(rhs);
>     return *this;
> }
>

http://stackoverflow.com/questions/7458110/c-unified-assignment-operator-move-semantics/7458222#7458222
http://stackoverflow.com/questions/18303287/when-is-overloading-pass-by-reference-l-value-and-r-value-preferred-to-pass-by/18303787#18303787

--

---
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/.

--001a11c1a2365b849e05058fece8
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On W=
ed, Oct 15, 2014 at 11:40 PM, Markus Grech <span dir=3D"ltr">&lt;<a href=3D=
"mailto:markus.grech@gmail.com" target=3D"_blank">markus.grech@gmail.com</a=
>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0p=
x 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);bo=
rder-left-style:solid;padding-left:1ex"><div dir=3D"ltr">I&#39;m very surpr=
ised that nobody here knows how to write copy&amp;swap correctly.<div><div =
style=3D"border:1px solid rgb(187,187,187);word-wrap:break-word;background-=
color:rgb(250,250,250)"><code><div><font color=3D"#660066"><span style=3D"c=
olor:rgb(0,0,0)">T</span><span style=3D"color:rgb(102,102,0)">&amp;</span><=
span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,0,136)">=
operator</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"colo=
r:rgb(102,102,0)">=3D(</span><span style=3D"color:rgb(0,0,0)">T rhs</span><=
span style=3D"color:rgb(102,102,0)">)</span><span style=3D"color:rgb(0,0,0)=
"><br></span><span style=3D"color:rgb(102,102,0)">{</span><span style=3D"co=
lor:rgb(0,0,0)"><br>=C2=A0 =C2=A0 swap</span><span style=3D"color:rgb(102,1=
02,0)">(</span><span style=3D"color:rgb(0,0,0)">rhs</span><span style=3D"co=
lor:rgb(102,102,0)">);</span><span style=3D"color:rgb(0,0,0)"><br></span></=
font><span style=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(0,0,0)">=C2=
=A0 =C2=A0 </span><span style=3D"color:rgb(0,0,136)">return</span><span sty=
le=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">*</spa=
n><span style=3D"color:rgb(0,0,136)">this</span><span style=3D"color:rgb(10=
2,102,0)">;</span></span><font color=3D"#660066"><span style=3D"color:rgb(0=
,0,0)"><br></span><span style=3D"color:rgb(102,102,0)">}</span></font></div=
></code></div></div></div></blockquote><div><br></div><div><a href=3D"http:=
//stackoverflow.com/questions/7458110/c-unified-assignment-operator-move-se=
mantics/7458222#7458222">http://stackoverflow.com/questions/7458110/c-unifi=
ed-assignment-operator-move-semantics/7458222#7458222</a><br></div><div><a =
href=3D"http://stackoverflow.com/questions/18303287/when-is-overloading-pas=
s-by-reference-l-value-and-r-value-preferred-to-pass-by/18303787#18303787">=
http://stackoverflow.com/questions/18303287/when-is-overloading-pass-by-ref=
erence-l-value-and-r-value-preferred-to-pass-by/18303787#18303787</a></div>=
</div></div></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--001a11c1a2365b849e05058fece8--

.


Author: Farid Mehrabi <farid.mehrabi@gmail.com>
Date: Tue, 21 Oct 2014 22:24:01 +0330
Raw View
--001a11c3a16af740060505f35b07
Content-Type: text/plain; charset=UTF-8

2014-10-16 23:46 GMT+03:30 Richard Smith <richard@metafoo.co.uk>:

> On Wed, Oct 15, 2014 at 11:40 PM, Markus Grech <markus.grech@gmail.com>
> wrote:
>
>> I'm very surprised that nobody here knows how to write copy&swap
>> correctly.
>> T& operator =(T rhs)
>> {
>>     swap(rhs);
>>     return *this;
>> }
>>
>
>
> http://stackoverflow.com/questions/7458110/c-unified-assignment-operator-move-semantics/7458222#7458222
>
> http://stackoverflow.com/questions/18303287/when-is-overloading-pass-by-reference-l-value-and-r-value-preferred-to-pass-by/18303787#18303787
>

what is the point in that link? why so much verbosity?
simpler code is easier to maintain and Markus`s code generates optimal code
for most cases(assuming improbability of self assignment).

regards,
FM.


--
how am I supposed to end the twisted road of  your hair in the dark night??
unless the candle of your face does turn a lamp up on my way!!!

--

---
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/.

--001a11c3a16af740060505f35b07
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"rtl"><div dir=3D"ltr"><br></div><div class=3D"gmail_extra"><div=
 dir=3D"ltr"><br><div class=3D"gmail_quote">2014-10-16 23:46 GMT+03:30 Rich=
ard Smith <span dir=3D"ltr">&lt;<a href=3D"mailto:richard@metafoo.co.uk" ta=
rget=3D"_blank">richard@metafoo.co.uk</a>&gt;</span>:<br><blockquote class=
=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;bo=
rder-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">=
<div class=3D"gmail_extra"><div class=3D"gmail_quote"><span class=3D"">On W=
ed, Oct 15, 2014 at 11:40 PM, Markus Grech <span dir=3D"ltr">&lt;<a href=3D=
"mailto:markus.grech@gmail.com" target=3D"_blank">markus.grech@gmail.com</a=
>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0p=
x 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);bo=
rder-left-style:solid;padding-left:1ex"><div dir=3D"ltr">I&#39;m very surpr=
ised that nobody here knows how to write copy&amp;swap correctly.<div><div =
style=3D"border:1px solid rgb(187,187,187);word-wrap:break-word;background-=
color:rgb(250,250,250)"><code><div><font color=3D"#660066"><span style=3D"c=
olor:rgb(0,0,0)">T</span><span style=3D"color:rgb(102,102,0)">&amp;</span><=
span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,0,136)">=
operator</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"colo=
r:rgb(102,102,0)">=3D(</span><span style=3D"color:rgb(0,0,0)">T rhs</span><=
span style=3D"color:rgb(102,102,0)">)</span><span style=3D"color:rgb(0,0,0)=
"><br></span><span style=3D"color:rgb(102,102,0)">{</span><span style=3D"co=
lor:rgb(0,0,0)"><br>=C2=A0 =C2=A0 swap</span><span style=3D"color:rgb(102,1=
02,0)">(</span><span style=3D"color:rgb(0,0,0)">rhs</span><span style=3D"co=
lor:rgb(102,102,0)">);</span><span style=3D"color:rgb(0,0,0)"><br></span></=
font><span style=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(0,0,0)">=C2=
=A0 =C2=A0 </span><span style=3D"color:rgb(0,0,136)">return</span><span sty=
le=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">*</spa=
n><span style=3D"color:rgb(0,0,136)">this</span><span style=3D"color:rgb(10=
2,102,0)">;</span></span><font color=3D"#660066"><span style=3D"color:rgb(0=
,0,0)"><br></span><span style=3D"color:rgb(102,102,0)">}</span></font></div=
></code></div></div></div></blockquote><div><br></div></span><div><a href=
=3D"http://stackoverflow.com/questions/7458110/c-unified-assignment-operato=
r-move-semantics/7458222#7458222" target=3D"_blank">http://stackoverflow.co=
m/questions/7458110/c-unified-assignment-operator-move-semantics/7458222#74=
58222</a><br></div><div><a href=3D"http://stackoverflow.com/questions/18303=
287/when-is-overloading-pass-by-reference-l-value-and-r-value-preferred-to-=
pass-by/18303787#18303787" target=3D"_blank">http://stackoverflow.com/quest=
ions/18303287/when-is-overloading-pass-by-reference-l-value-and-r-value-pre=
ferred-to-pass-by/18303787#18303787</a></div></div></div></blockquote></div=
><div class=3D""><div class=3D"h5">

<p></p></div></div></div><div><br></div><div dir=3D"ltr">what is the point =
in that link? why so much verbosity?</div><div dir=3D"ltr">simpler code is =
easier to=C2=A0<span style=3D"font-family:arial,sans-serif;font-size:13px">=
maintain and=C2=A0</span>Markus`s code generates optimal code for most case=
s(assuming improbability of self assignment).</div><div dir=3D"ltr"><br></d=
iv><div dir=3D"ltr">regards,</div><div dir=3D"ltr">FM.</div><div dir=3D"ltr=
"><br></div><div dir=3D"ltr">=C2=A0</div>-- <br><div dir=3D"ltr">how am I s=
upposed to end the twisted road of=C2=A0 your hair in the dark night??<br>u=
nless the candle of your face does turn a lamp up on my way!!!<br></div>
</div></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--001a11c3a16af740060505f35b07--

.


Author: Markus Grech <markus.grech@gmail.com>
Date: Wed, 22 Oct 2014 03:27:13 -0700 (PDT)
Raw View
------=_Part_5339_2026213848.1413973633846
Content-Type: text/plain; charset=UTF-8



On Tuesday, October 21, 2014 8:54:23 PM UTC+2, Farid Mehrabi wrote:
>
>
>
> 2014-10-16 23:46 GMT+03:30 Richard Smith <ric...@metafoo.co.uk
> <javascript:>>:
>
>> On Wed, Oct 15, 2014 at 11:40 PM, Markus Grech <markus...@gmail.com
>> <javascript:>> wrote:
>>
>>> I'm very surprised that nobody here knows how to write copy&swap
>>> correctly.
>>> T& operator =(T rhs)
>>> {
>>>     swap(rhs);
>>>     return *this;
>>> }
>>>
>>
>>
>> http://stackoverflow.com/questions/7458110/c-unified-assignment-operator-move-semantics/7458222#7458222
>>
>> http://stackoverflow.com/questions/18303287/when-is-overloading-pass-by-reference-l-value-and-r-value-preferred-to-pass-by/18303787#18303787
>>
>
> what is the point in that link? why so much verbosity?
> simpler code is easier to maintain and Markus`s code generates optimal
> code for most cases(assuming improbability of self assignment).
>
> regards,
> FM.
>
>
> --
> how am I supposed to end the twisted road of  your hair in the dark night??
> unless the candle of your face does turn a lamp up on my way!!!
>
There is no possibility of self assignment, because the parameter is always
newly constructed.

--

---
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/.

------=_Part_5339_2026213848.1413973633846
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Tuesday, October 21, 2014 8:54:23 PM UTC+2, Far=
id Mehrabi wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"r=
tl"><div dir=3D"ltr"><br></div><div><div dir=3D"ltr"><br><div class=3D"gmai=
l_quote">2014-10-16 23:46 GMT+03:30 Richard Smith <span dir=3D"ltr">&lt;<a =
href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"U8e3RKgLsPM=
J" onmousedown=3D"this.href=3D'javascript:';return true;" onclick=3D"this.h=
ref=3D'javascript:';return true;">ric...@metafoo.co.uk</a>&gt;</span>:<br><=
blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l=
eft-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;pa=
dding-left:1ex"><div><div class=3D"gmail_quote"><span>On Wed, Oct 15, 2014 =
at 11:40 PM, Markus Grech <span dir=3D"ltr">&lt;<a href=3D"javascript:" tar=
get=3D"_blank" gdf-obfuscated-mailto=3D"U8e3RKgLsPMJ" onmousedown=3D"this.h=
ref=3D'javascript:';return true;" onclick=3D"this.href=3D'javascript:';retu=
rn true;">markus...@gmail.com</a>&gt;</span> wrote:<br><blockquote class=3D=
"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;borde=
r-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><di=
v dir=3D"ltr">I'm very surprised that nobody here knows how to write copy&a=
mp;swap correctly.<div><div style=3D"border:1px solid rgb(187,187,187);word=
-wrap:break-word;background-color:rgb(250,250,250)"><code><div><font color=
=3D"#660066"><span style=3D"color:rgb(0,0,0)">T</span><span style=3D"color:=
rgb(102,102,0)">&amp;</span><span style=3D"color:rgb(0,0,0)"> </span><span =
style=3D"color:rgb(0,0,136)">operator</span><span style=3D"color:rgb(0,0,0)=
"> </span><span style=3D"color:rgb(102,102,0)">=3D(</span><span style=3D"co=
lor:rgb(0,0,0)">T rhs</span><span style=3D"color:rgb(102,102,0)">)</span><s=
pan style=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:rgb(102,102,=
0)">{</span><span style=3D"color:rgb(0,0,0)"><br>&nbsp; &nbsp; swap</span><=
span style=3D"color:rgb(102,102,0)">(</span><span style=3D"color:rgb(0,0,0)=
">rhs</span><span style=3D"color:rgb(102,102,0)">);</span><span style=3D"co=
lor:rgb(0,0,0)"><br></span></font><span style=3D"color:rgb(0,0,0)"><span st=
yle=3D"color:rgb(0,0,0)">&nbsp; &nbsp; </span><span style=3D"color:rgb(0,0,=
136)">return</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"=
color:rgb(102,102,0)">*</span><span style=3D"color:rgb(0,0,136)">this</span=
><span style=3D"color:rgb(102,102,0)">;</span></span><font color=3D"#660066=
"><span style=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:rgb(102,=
102,0)">}</span></font></div></code></div></div></div></blockquote><div><br=
></div></span><div><a href=3D"http://stackoverflow.com/questions/7458110/c-=
unified-assignment-operator-move-semantics/7458222#7458222" target=3D"_blan=
k" onmousedown=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fs=
tackoverflow.com%2Fquestions%2F7458110%2Fc-unified-assignment-operator-move=
-semantics%2F7458222%237458222\46sa\75D\46sntz\0751\46usg\75AFQjCNFrJVdnOTm=
h_6aziazDLDCZOsRd1Q';return true;" onclick=3D"this.href=3D'http://www.googl=
e.com/url?q\75http%3A%2F%2Fstackoverflow.com%2Fquestions%2F7458110%2Fc-unif=
ied-assignment-operator-move-semantics%2F7458222%237458222\46sa\75D\46sntz\=
0751\46usg\75AFQjCNFrJVdnOTmh_6aziazDLDCZOsRd1Q';return true;">http://stack=
overflow.com/<wbr>questions/7458110/c-unified-<wbr>assignment-operator-move=
-<wbr>semantics/7458222#7458222</a><br></div><div><a href=3D"http://stackov=
erflow.com/questions/18303287/when-is-overloading-pass-by-reference-l-value=
-and-r-value-preferred-to-pass-by/18303787#18303787" target=3D"_blank" onmo=
usedown=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fstackove=
rflow.com%2Fquestions%2F18303287%2Fwhen-is-overloading-pass-by-reference-l-=
value-and-r-value-preferred-to-pass-by%2F18303787%2318303787\46sa\75D\46snt=
z\0751\46usg\75AFQjCNGBcPCibDDrFxL4RndxBW5P8Gpy0g';return true;" onclick=3D=
"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fstackoverflow.com%=
2Fquestions%2F18303287%2Fwhen-is-overloading-pass-by-reference-l-value-and-=
r-value-preferred-to-pass-by%2F18303787%2318303787\46sa\75D\46sntz\0751\46u=
sg\75AFQjCNGBcPCibDDrFxL4RndxBW5P8Gpy0g';return true;">http://stackoverflow=
..com/<wbr>questions/18303287/when-is-<wbr>overloading-pass-by-reference-<wb=
r>l-value-and-r-value-preferred-<wbr>to-pass-by/18303787#18303787</a></div>=
</div></div></blockquote></div><div><div>

<p></p></div></div></div><div><br></div><div dir=3D"ltr">what is the point =
in that link? why so much verbosity?</div><div dir=3D"ltr">simpler code is =
easier to&nbsp;<span style=3D"font-family:arial,sans-serif;font-size:13px">=
maintain and&nbsp;</span>Markus`s code generates optimal code for most case=
s(assuming improbability of self assignment).</div><div dir=3D"ltr"><br></d=
iv><div dir=3D"ltr">regards,</div><div dir=3D"ltr">FM.</div><div dir=3D"ltr=
"><br></div><div dir=3D"ltr">&nbsp;</div>-- <br><div dir=3D"ltr">how am I s=
upposed to end the twisted road of&nbsp; your hair in the dark night??<br>u=
nless the candle of your face does turn a lamp up on my way!!!<br></div></d=
iv></div></blockquote><div>There is no possibility of self assignment, beca=
use the parameter is always newly constructed.&nbsp;</div></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_5339_2026213848.1413973633846--

.


Author: Olaf van der Spek <olafvdspek@gmail.com>
Date: Wed, 22 Oct 2014 08:31:56 -0700 (PDT)
Raw View
------=_Part_3781_220329307.1413991916580
Content-Type: text/plain; charset=UTF-8

On Thursday, October 16, 2014 12:22:53 AM UTC+2, Myriachan wrote:
>
> The main reason to use something like this is for copy constructors.
> Sometimes, the most convenient way to implement a copy or move constructor
> is like this:
>
> T &T::operator =(const T &copy)
> {
>     if (&copy != this)
>     {
>         this->~T();
>         new(this) T(copy);
>     }
>     return *this;
> }
>
> ...and equivalently with std::forward for move constructors.
>
>
Can't you forward to the assignment operator in that case (most of the
time)?

--

---
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/.

------=_Part_3781_220329307.1413991916580
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Thursday, October 16, 2014 12:22:53 AM UTC+2, Myriachan=
 wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.=
8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div>T=
he main reason to use something like this is for copy constructors.&nbsp; S=
ometimes, the most convenient way to implement a copy or move constructor i=
s like this:<br><br><div style=3D"background-color:rgb(250,250,250);border-=
color:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:break-=
word"><code><div><span style=3D"color:#000">T </span><span style=3D"color:#=
660">&amp;</span><span style=3D"color:#000">T</span><span style=3D"color:#6=
60">::</span><span style=3D"color:#008">operator</span><span style=3D"color=
:#000"> </span><span style=3D"color:#660">=3D(</span><span style=3D"color:#=
008">const</span><span style=3D"color:#000"> T </span><span style=3D"color:=
#660">&amp;</span><span style=3D"color:#000">copy</span><span style=3D"colo=
r:#660">)</span><span style=3D"color:#000"><br></span><span style=3D"color:=
#660">{</span><span style=3D"color:#000"><br>&nbsp; &nbsp; </span><span sty=
le=3D"color:#008">if</span><span style=3D"color:#000"> </span><span style=
=3D"color:#660">(&amp;</span><span style=3D"color:#000">copy </span><span s=
tyle=3D"color:#660">!=3D</span><span style=3D"color:#000"> </span><span sty=
le=3D"color:#008">this</span><span style=3D"color:#660">)</span><span style=
=3D"color:#000"><br>&nbsp; &nbsp; </span><span style=3D"color:#660">{</span=
><span style=3D"color:#000"><br>&nbsp; &nbsp; &nbsp; &nbsp; </span><span st=
yle=3D"color:#008">this</span><span style=3D"color:#660">-&gt;~</span><span=
 style=3D"color:#000">T</span><span style=3D"color:#660">();</span><span st=
yle=3D"color:#000"><br>&nbsp; &nbsp; &nbsp; &nbsp; </span><span style=3D"co=
lor:#008">new</span><span style=3D"color:#660">(</span><span style=3D"color=
:#008">this</span><span style=3D"color:#660">)</span><span style=3D"color:#=
000"> T</span><span style=3D"color:#660">(</span><span style=3D"color:#000"=
>copy</span><span style=3D"color:#660">);</span><span style=3D"color:#000">=
<br>&nbsp; &nbsp; </span><span style=3D"color:#660">}</span><span style=3D"=
color:#000"><br>&nbsp; &nbsp; </span><span style=3D"color:#008">return</spa=
n><span style=3D"color:#000"> </span><span style=3D"color:#660">*</span><sp=
an style=3D"color:#008">this</span><span style=3D"color:#660">;</span><span=
 style=3D"color:#000"><br></span><span style=3D"color:#660">}</span><span s=
tyle=3D"color:#000"><br></span></div></code></div><br>...and equivalently w=
ith std::forward for move constructors.<br><br></div></div></blockquote><di=
v><br></div><div>Can't you forward to the assignment operator in that case =
(most of the time)?&nbsp;</div></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_3781_220329307.1413991916580--

.


Author: Olaf van der Spek <olafvdspek@gmail.com>
Date: Wed, 22 Oct 2014 08:32:41 -0700 (PDT)
Raw View
------=_Part_6167_1547664504.1413991961729
Content-Type: text/plain; charset=UTF-8



On Wednesday, October 15, 2014 11:48:11 PM UTC+2, Nevin ":-)" Liber wrote:
>
>
> On 15 October 2014 16:17, Myriachan <myri...@gmail.com <javascript:>>
> wrote:
>
>> While that is a nice feature, it's not the same as needing to do this to
>> types that weren't created as std::optional<T>.
>>
>
> It is also *extremely* unsafe to do it with any class that can throw an
> exception during construction or destruction.  Why would we want to
> encourage such a bad habit?  I would vote strongly against such a
> proposal.  Even if you SFINAEed it so that it only worked with constructors
> and destructors marked noexcept, I'd still vote against it, as 99% of users
> should never use such a function.
>
> Dear Nevin,

Why do you have bring up voting so often?


--

---
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/.

------=_Part_6167_1547664504.1413991961729
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Wednesday, October 15, 2014 11:48:11 PM UTC+2, =
Nevin ":-)" Liber wrote:<blockquote class=3D"gmail_quote" style=3D"margin: =
0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div d=
ir=3D"ltr"><br><div class=3D"gmail_quote">On 15 October 2014 16:17, Myriach=
an <span dir=3D"ltr">&lt;<a href=3D"javascript:" target=3D"_blank" gdf-obfu=
scated-mailto=3D"bRh48Qt7Np8J" onmousedown=3D"this.href=3D'javascript:';ret=
urn true;" onclick=3D"this.href=3D'javascript:';return true;">myri...@gmail=
..com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"ma=
rgin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>While tha=
t is a nice feature, it's not the same as needing to do this to types that =
weren't created as <span style=3D"font-family:courier new,monospace">std::o=
ptional&lt;T&gt;</span>. <br></div></blockquote></div><br>It is also <i>ext=
remely</i>&nbsp;unsafe to do it with any class that can throw an exception =
during construction or destruction.&nbsp; Why would we want to encourage su=
ch a bad habit?&nbsp; I would vote strongly against such a proposal.&nbsp; =
Even if you SFINAEed it so that it only worked with constructors and destru=
ctors marked noexcept, I'd still vote against it, as 99% of users should ne=
ver use such a function.<br><br></div></blockquote><div>Dear Nevin,</div><d=
iv><br></div><div>Why do you have bring up voting so often?</div><div><br><=
/div><div><br></div></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_6167_1547664504.1413991961729--

.


Author: Nevin Liber <nevin@eviloverlord.com>
Date: Wed, 22 Oct 2014 10:40:02 -0500
Raw View
--047d7bfced1c409767050604c5f9
Content-Type: text/plain; charset=UTF-8

On 22 October 2014 10:32, Olaf van der Spek <olafvdspek@gmail.com> wrote:

>
> Dear Nevin,
>
> Why do you have bring up voting so often?
>

I thought people wanted committee member feedback.  Oh, well...

As we like to say, until you write a paper and present it in front of the
committee, it's your time to waste.  Who am I to stop you?  I'll save more
of my arguments for if/when that actually happens.
--
 Nevin ":-)" Liber  <mailto:nevin@eviloverlord.com>  (847) 691-1404

--

---
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/.

--047d7bfced1c409767050604c5f9
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On 22 October 2014 10:32, Olaf van der Spek <span dir=3D"l=
tr">&lt;<a href=3D"mailto:olafvdspek@gmail.com" target=3D"_blank">olafvdspe=
k@gmail.com</a>&gt;</span> wrote:<br><div class=3D"gmail_extra"><div class=
=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8=
ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><br>Dear N=
evin,<br><div><br></div><div>Why do you have bring up voting so often?</div=
></div></blockquote><div><br></div><div>I thought people wanted committee m=
ember feedback.=C2=A0 Oh, well...</div><div><br></div><div>As we like to sa=
y, until you write a paper and present it in front of the committee, it&#39=
;s your time to waste.=C2=A0 Who am I to stop you?=C2=A0 I&#39;ll save more=
 of my arguments for if/when that actually happens.</div></div>-- <br>=C2=
=A0Nevin &quot;:-)&quot; Liber=C2=A0 &lt;mailto:<a href=3D"mailto:nevin@evi=
loverlord.com" target=3D"_blank">nevin@eviloverlord.com</a>&gt;=C2=A0 (847)=
 691-1404
</div></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--047d7bfced1c409767050604c5f9--

.