<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Exceptionally&#160;Moving!</title>
	<atom:link href="http://cpp-next.com/archive/2009/10/exceptionally-moving/feed/" rel="self" type="application/rss+xml" />
	<link>http://cpp-next.com/archive/2009/10/exceptionally-moving/</link>
	<description>The next generation of C++</description>
	<lastBuildDate>Mon, 30 Apr 2012 15:07:48 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Dave Abrahams</title>
		<link>http://cpp-next.com/archive/2009/10/exceptionally-moving/comment-page-1/#comment-242</link>
		<dc:creator>Dave Abrahams</dc:creator>
		<pubDate>Sun, 22 Aug 2010 15:11:23 +0000</pubDate>
		<guid isPermaLink="false">http://cpp-next.com/?p=621#comment-242</guid>
		<description>&lt;blockquote cite=&quot;comment-736&quot;&gt;
Thanks for a very interesting site.
&lt;/blockquote&gt;

&lt;p&gt;You&#039;re welcome; it&#039;s my pleasure!&lt;/p&gt;

&lt;blockquote cite=&quot;comment-736&quot;&gt;
I don’t claim to understand this stuff as well as the posters here, but it feels like a big disappointment that the move operations of the standard containers are not required to be no-throw. Doesn’t that make it impossible to write our own non-throwing move-enabled classes in terms of the standard containers (without adding a level of indirection)?
&lt;/blockquote&gt;

&lt;p&gt;The circumstances where you can&#039;t actually write such a non-throwing move-enabled class without indirection are actually considerably narrower than that.  But that&#039;s not the interesting part.  The interesting part is that it usually doesn&#039;t matter whether a move constructor throws.  I&#039;m long overdue for writing an article explaining the issues as they have finally shaken out, including the outcome for &lt;a href=&quot;https://svn.boost.org/svn/boost/sandbox/committee/rvalue_ref/N2983.html&quot; rel=&quot;nofollow&quot;&gt;N2983&lt;/a&gt;.  I promise to get something out in the next week or so.&lt;/p&gt;

&lt;blockquote cite=&quot;comment-736&quot;&gt;


If I understand the comments correctly, the reason for not requiring no-throw is that we may need to allocate memory in order to put the moved-from object back into a usable state.
&lt;/blockquote&gt;

&lt;p&gt;Not really.  Try to hang in there for a followup article where I can explain this.&lt;/p&gt;

&lt;blockquote cite=&quot;comment-736&quot;&gt;
But (again I may be misunderstanding this) the standard isn’t offering us any guarantees about the state of a moved-from container anyway.
&lt;/blockquote&gt;

&lt;p&gt;The standard guarantees that the object still functions as a well-behaved instance of the type, but beyond that, no, you don&#039;t know anything about its state.&lt;/p&gt;

&lt;blockquote cite=&quot;comment-736&quot;&gt;
For example we can’t (portably) call push_back on a moved-from std::list and expect it to end up with size() == 1. If all we can reliably do with a moved-from container is to assign to it or destroy it,
&lt;/blockquote&gt;

&lt;p&gt;That overstates the case.  You can reliably do all the same things with a moved-from container that you can do with a container someone has passed to a function by reference, where (unless you&#039;ve imposed requirements in documentation) you don&#039;t know anything about the state of that container.&lt;/p&gt;

&lt;blockquote cite=&quot;comment-736&quot;&gt;
and a move constructor which does this can be implemented without any allocation (yes?), wouldn’t it have made sense to require a non-throwing implentation?
&lt;blockquote cite=&quot;comment-736&quot;&gt;
Frankly I need to go back and review the state of the [latest draft standard](http://open-std.org/JTC1/SC22/WG21/docs/papers/2010/n3090.pdf) before I can responsibly accept your premises about `std::list`.
&lt;/blockquote&gt;
(Apologies for commenting so long after the event; a year ago I’d only just learnt what a copy constructor was, never mind a move constructor…)
&lt;/blockquote&gt;

&lt;p&gt;Comments are always welcome; thanks for being part of the community!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<blockquote cite="comment-736">
Thanks for a very interesting site.
</blockquote>

<p>You&#8217;re welcome; it&#8217;s my pleasure!</p>

<blockquote cite="comment-736">
I don’t claim to understand this stuff as well as the posters here, but it feels like a big disappointment that the move operations of the standard containers are not required to be no-throw. Doesn’t that make it impossible to write our own non-throwing move-enabled classes in terms of the standard containers (without adding a level of indirection)?
</blockquote>

<p>The circumstances where you can&#8217;t actually write such a non-throwing move-enabled class without indirection are actually considerably narrower than that.  But that&#8217;s not the interesting part.  The interesting part is that it usually doesn&#8217;t matter whether a move constructor throws.  I&#8217;m long overdue for writing an article explaining the issues as they have finally shaken out, including the outcome for <a href="https://svn.boost.org/svn/boost/sandbox/committee/rvalue_ref/N2983.html" rel="nofollow">N2983</a>.  I promise to get something out in the next week or so.</p>

<blockquote cite="comment-736">


If I understand the comments correctly, the reason for not requiring no-throw is that we may need to allocate memory in order to put the moved-from object back into a usable state.
</blockquote>

<p>Not really.  Try to hang in there for a followup article where I can explain this.</p>

<blockquote cite="comment-736">
But (again I may be misunderstanding this) the standard isn’t offering us any guarantees about the state of a moved-from container anyway.
</blockquote>

<p>The standard guarantees that the object still functions as a well-behaved instance of the type, but beyond that, no, you don&#8217;t know anything about its state.</p>

<blockquote cite="comment-736">
For example we can’t (portably) call push_back on a moved-from std::list and expect it to end up with size() == 1. If all we can reliably do with a moved-from container is to assign to it or destroy it,
</blockquote>

<p>That overstates the case.  You can reliably do all the same things with a moved-from container that you can do with a container someone has passed to a function by reference, where (unless you&#8217;ve imposed requirements in documentation) you don&#8217;t know anything about the state of that container.</p>

<blockquote cite="comment-736">
and a move constructor which does this can be implemented without any allocation (yes?), wouldn’t it have made sense to require a non-throwing implentation?
<blockquote cite="comment-736">
Frankly I need to go back and review the state of the [latest draft standard](<a href="http://open-std.org/JTC1/SC22/WG21/docs/papers/2010/n3090.pdf" rel="nofollow">http://open-std.org/JTC1/SC22/WG21/docs/papers/2010/n3090.pdf</a>) before I can responsibly accept your premises about `std::list`.
</blockquote>
(Apologies for commenting so long after the event; a year ago I’d only just learnt what a copy constructor was, never mind a move constructor…)
</blockquote>

<p>Comments are always welcome; thanks for being part of the community!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Collier</title>
		<link>http://cpp-next.com/archive/2009/10/exceptionally-moving/comment-page-1/#comment-241</link>
		<dc:creator>David Collier</dc:creator>
		<pubDate>Sat, 21 Aug 2010 12:45:18 +0000</pubDate>
		<guid isPermaLink="false">http://cpp-next.com/?p=621#comment-241</guid>
		<description>&lt;p&gt;Thanks for a very interesting site.&lt;/p&gt;

&lt;p&gt;I don&#039;t claim to understand this stuff as well as the posters here, but it feels like a big disappointment that the move operations of the standard containers are not required to be no-throw. Doesn&#039;t that make it impossible to write our own non-throwing move-enabled classes in terms of the standard containers (without adding a level of indirection)?&lt;/p&gt;

&lt;p&gt;If I understand the comments correctly, the reason for not requiring no-throw is that we may need to allocate memory in order to put the moved-from object back into a usable state. But (again I may be misunderstanding this) the standard isn&#039;t offering us any guarantees about the state of a moved-from container anyway. For example we can&#039;t (portably) call push_back on a moved-from std::list and expect it to end up with size() == 1. If all we can reliably do with a moved-from container is to assign to it or destroy it, and a move constructor which does this can be implemented without any allocation (yes?), wouldn&#039;t it have made sense to require a non-throwing implentation?&lt;/p&gt;

&lt;p&gt;(Apologies for commenting so long after the event; a year ago I&#039;d only just learnt what a copy constructor was, never mind a move constructor...)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Thanks for a very interesting site.</p>

<p>I don&#8217;t claim to understand this stuff as well as the posters here, but it feels like a big disappointment that the move operations of the standard containers are not required to be no-throw. Doesn&#8217;t that make it impossible to write our own non-throwing move-enabled classes in terms of the standard containers (without adding a level of indirection)?</p>

<p>If I understand the comments correctly, the reason for not requiring no-throw is that we may need to allocate memory in order to put the moved-from object back into a usable state. But (again I may be misunderstanding this) the standard isn&#8217;t offering us any guarantees about the state of a moved-from container anyway. For example we can&#8217;t (portably) call push_back on a moved-from std::list and expect it to end up with size() == 1. If all we can reliably do with a moved-from container is to assign to it or destroy it, and a move constructor which does this can be implemented without any allocation (yes?), wouldn&#8217;t it have made sense to require a non-throwing implentation?</p>

<p>(Apologies for commenting so long after the event; a year ago I&#8217;d only just learnt what a copy constructor was, never mind a move constructor&#8230;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sebastian</title>
		<link>http://cpp-next.com/archive/2009/10/exceptionally-moving/comment-page-1/#comment-240</link>
		<dc:creator>Sebastian</dc:creator>
		<pubDate>Wed, 10 Feb 2010 19:24:03 +0000</pubDate>
		<guid isPermaLink="false">http://cpp-next.com/?p=621#comment-240</guid>
		<description>&lt;p&gt;OK, now I see the advantage of &lt;code&gt;move_if_noexcept&lt;/code&gt; returning &lt;code&gt;T&amp;&amp;&lt;/code&gt; for move-only types. It&#039;s quite possible that overly conservative implementations of &lt;code&gt;nothrow_xxx&lt;/code&gt; will evaluate to false even for types like unique_ptr with non-throwing move operations. But if we return &lt;code&gt;T const&amp;&lt;/code&gt; in those cases the code won&#039;t compile on some C++ implementations. This is bad. Better: Overly conservative &lt;code&gt;nothrow_xxx&lt;/code&gt; implementations should only decrease performance (if anything) but not stop code from compiling. Returning &lt;code&gt;T&amp;&amp;&lt;/code&gt; in those cases is exactly what the proposed move_if_noexcept from N2983 does and I agree that it&#039;s the way to go. In this light, the function&#039;s name is short for &quot;move if no exception can be thrown OR we don&#039;t have a choice w.r.t. move-only types&quot;.&lt;/p&gt;

&lt;p&gt;But what about move assignment?&lt;/p&gt;

&lt;p&gt;After some further pondering I came to the following conclusion (using proposed type traits from N2983):&lt;/p&gt;

&lt;pre&gt;&#160;
  template&lt;typename T&gt;
  struct has_potentially_throwing_move_ctor
  : std::integral_constant&lt;bool,&#040;
    has_move_constructor&lt;T&gt;::value &amp;&amp;
    !nothrow_move_constructible&lt;T&gt;::value
  &#041;&gt; &#123;&#125;;
&#160;
  template&lt;typename T&gt;
  struct has_potentially_throwing_move_assign
  : std::integral_constant&lt;bool,&#040;
    has_move_assign&lt;T&gt;::value &amp;&amp;
    !nothrow_move_assignable&lt;T&gt;::value
  &#041;&gt; &#123;&#125;;
&#160;
   template &lt;class T&gt;
  typename conditional&lt;
       (   has_potentially_throwing_move_ctor&lt;T&gt;
        &amp;&amp; has_copy_constructor&lt;T&gt; )
    &#124;&#124; (   has_potentially_throwing_move_assign&lt;T&gt;
        &amp;&amp; has_copy_assignment&lt;T&gt; ) ,
    T const&amp;,
    T&amp;&amp;
  &gt;::type move_if_noexcept(T&amp; x) { return std::move(x); }
&#160;&lt;/pre&gt;

&lt;p&gt;The function doesn&#039;t exactly behave like its name suggests -- it does return &lt;code&gt;T&amp;&amp;&lt;/code&gt; in some cases even if a move operation potentially throws -- so maybe there&#039;s a better name for it. But currently, its behaviour looks like a good compromise to me.&lt;/p&gt;

&lt;p&gt;I&#039;d love some feedback.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>OK, now I see the advantage of <code>move_if_noexcept</code> returning <code>T&amp;&amp;</code> for move-only types. It&#8217;s quite possible that overly conservative implementations of <code>nothrow_xxx</code> will evaluate to false even for types like unique_ptr with non-throwing move operations. But if we return <code>T const&amp;</code> in those cases the code won&#8217;t compile on some C++ implementations. This is bad. Better: Overly conservative <code>nothrow_xxx</code> implementations should only decrease performance (if anything) but not stop code from compiling. Returning <code>T&amp;&amp;</code> in those cases is exactly what the proposed move_if_noexcept from N2983 does and I agree that it&#8217;s the way to go. In this light, the function&#8217;s name is short for &#8220;move if no exception can be thrown OR we don&#8217;t have a choice w.r.t. move-only types&#8221;.</p>

<p>But what about move assignment?</p>

<p>After some further pondering I came to the following conclusion (using proposed type traits from N2983):</p>

<pre>&nbsp;
  template&lt;typename T&gt;
  struct has_potentially_throwing_move_ctor
  : std::integral_constant&lt;bool,&#040;
    has_move_constructor&lt;T&gt;::value &amp;&amp;
    !nothrow_move_constructible&lt;T&gt;::value
  &#041;&gt; &#123;&#125;;
&nbsp;
  template&lt;typename T&gt;
  struct has_potentially_throwing_move_assign
  : std::integral_constant&lt;bool,&#040;
    has_move_assign&lt;T&gt;::value &amp;&amp;
    !nothrow_move_assignable&lt;T&gt;::value
  &#041;&gt; &#123;&#125;;
&nbsp;
   template &lt;class T&gt;
  typename conditional&lt;
       (   has_potentially_throwing_move_ctor&lt;T&gt;
        &amp;&amp; has_copy_constructor&lt;T&gt; )
    || (   has_potentially_throwing_move_assign&lt;T&gt;
        &amp;&amp; has_copy_assignment&lt;T&gt; ) ,
    T const&amp;,
    T&amp;&amp;
  &gt;::type move_if_noexcept(T&amp; x) { return std::move(x); }
&nbsp;</pre>

<p>The function doesn&#8217;t exactly behave like its name suggests &#8212; it does return <code>T&amp;&amp;</code> in some cases even if a move operation potentially throws &#8212; so maybe there&#8217;s a better name for it. But currently, its behaviour looks like a good compromise to me.</p>

<p>I&#8217;d love some feedback.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sebastian</title>
		<link>http://cpp-next.com/archive/2009/10/exceptionally-moving/comment-page-1/#comment-239</link>
		<dc:creator>Sebastian</dc:creator>
		<pubDate>Thu, 04 Feb 2010 22:02:15 +0000</pubDate>
		<guid isPermaLink="false">http://cpp-next.com/?p=621#comment-239</guid>
		<description>&lt;p&gt;Ok, I think I found a wart of my proposal. There&#039;s a category of move-only types that are not assignable. In this case nothrow_move_assignable&lt;T&gt; will be false (because there is no assignment) but that alone must not prevent move_if_noexcept from returning an rvalue reference. It&#039;ll get better if we say what we mean without negations:&lt;/p&gt;

&lt;pre&gt;template &lt;class T&gt;
 typename conditional&lt;
        potentially_throwing_construction&lt;T,T&amp;&amp;&gt;::value
     &#124;&#124; potentially_throwing_assignment&lt;T,T&amp;&amp;&gt;::value
     T const&amp;,
     T&amp;&amp;,
 &gt;::type
 move_if_noexcept&#040;T&amp; x&#041;
 &#123;
     return std::move&#040;x&#041;;
 &#125;
&#160;&lt;/pre&gt;

&lt;p&gt;I think that&#039;s exactly what move_if_noexcept should do. But I&#039;m not sure if it&#039;s possible to get something equivalent with the traits that are defined in N3000.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Ok, I think I found a wart of my proposal. There&#8217;s a category of move-only types that are not assignable. In this case nothrow_move_assignable&lt;T&gt; will be false (because there is no assignment) but that alone must not prevent move_if_noexcept from returning an rvalue reference. It&#8217;ll get better if we say what we mean without negations:</p>

<pre>template &lt;class T&gt;
 typename conditional&lt;
        potentially_throwing_construction&lt;T,T&amp;&amp;&gt;::value
     || potentially_throwing_assignment&lt;T,T&amp;&amp;&gt;::value
     T const&amp;,
     T&amp;&amp;,
 &gt;::type
 move_if_noexcept&#040;T&amp; x&#041;
 &#123;
     return std::move&#040;x&#041;;
 &#125;
&nbsp;</pre>

<p>I think that&#8217;s exactly what move_if_noexcept should do. But I&#8217;m not sure if it&#8217;s possible to get something equivalent with the traits that are defined in N3000.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sebastian</title>
		<link>http://cpp-next.com/archive/2009/10/exceptionally-moving/comment-page-1/#comment-238</link>
		<dc:creator>Sebastian</dc:creator>
		<pubDate>Thu, 04 Feb 2010 21:23:07 +0000</pubDate>
		<guid isPermaLink="false">http://cpp-next.com/?p=621#comment-238</guid>
		<description>&lt;p&gt;About move_if_noexcept of &lt;a href=&quot;http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2983.html&quot; rel=&quot;nofollow&quot;&gt;N2983&lt;/a&gt;: It is proposed to be&lt;/p&gt;

&lt;pre&gt;template &lt;class T&gt;
 typename conditional&lt;
     !nothrow_move_constructible&lt;T&gt;::value
     &amp;&amp; has_copy_constructor&lt;T&gt;::value,
     T const&amp;,
     T&amp;&amp;
 &gt;::type
 move_if_noexcept&#040;T&amp; x&#041;
 &#123;
     return std::move&#040;x&#041;;
 &#125;
&#160;&lt;/pre&gt;

&lt;p&gt;Let me rewrite the return type without double negative so it&#039;s less confusing:&lt;/p&gt;

&lt;pre&gt; typename conditional&lt;
     nothrow_move_constructible&lt;T&gt;::value
     &#124;&#124; !has_copy_constructor&lt;T&gt;::value,
     T&amp;&amp;
     T const&amp;,
 &gt;::type
&#160;&lt;/pre&gt;

&lt;p&gt;So, appearently move_if_noexcept also returns an rvalue reference for move-only types regardless of whether the move constructor throws or not. If the function&#039;s name is any indication of a contract this looks like a breach of contract to me.&lt;/p&gt;

&lt;p&gt;In addition, there&#039;s a chance that some user wants to use move_if_noexcept for move assignments as well, not just move constructions. But the conditional just checks for a throwing move construction. Now, I realize that for most move-enabled types nothrow_move_constructible&lt;T&gt; will be equal to nothrow_move_assignable&lt;T&gt; but it is also possibe to write a class where only one of these operations throws and the other one doesn&#039;t. Consider a type with a non-throwing move ctor but a throwing move assignment. This definition of move_if_noexcept will allow a throwing move assignment in this case.&lt;/p&gt;

&lt;p&gt;What about this one?&lt;/p&gt;

&lt;pre&gt;template &lt;class T&gt;
 typename conditional&lt;
     nothrow_move_constructible&lt;T&gt;::value
     &amp;&amp; nothrow_move_assignable&lt;T&gt;::value,
     T&amp;&amp;
     T const&amp;,
 &gt;::type
 move_if_noexcept&#040;T&amp; x&#041;
 &#123;
     return std::move&#040;x&#041;;
 &#125;
&#160;&lt;/pre&gt;

&lt;p&gt;This implementation honors its contract. It only returns an rvalue reference if both operations (move construction and move assignment) don&#039;t throw. In rare cases it&#039;ll decrease performance due to being a little more conservative. But I think that&#039;s acceptable. It&#039;ll also lead to some code being rejected. There just isn&#039;t anything you can do about move-only types with a throwing move, is there?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>About move_if_noexcept of <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2983.html" rel="nofollow">N2983</a>: It is proposed to be</p>

<pre>template &lt;class T&gt;
 typename conditional&lt;
     !nothrow_move_constructible&lt;T&gt;::value
     &amp;&amp; has_copy_constructor&lt;T&gt;::value,
     T const&amp;,
     T&amp;&amp;
 &gt;::type
 move_if_noexcept&#040;T&amp; x&#041;
 &#123;
     return std::move&#040;x&#041;;
 &#125;
&nbsp;</pre>

<p>Let me rewrite the return type without double negative so it&#8217;s less confusing:</p>

<pre> typename conditional&lt;
     nothrow_move_constructible&lt;T&gt;::value
     || !has_copy_constructor&lt;T&gt;::value,
     T&amp;&amp;
     T const&amp;,
 &gt;::type
&nbsp;</pre>

<p>So, appearently move_if_noexcept also returns an rvalue reference for move-only types regardless of whether the move constructor throws or not. If the function&#8217;s name is any indication of a contract this looks like a breach of contract to me.</p>

<p>In addition, there&#8217;s a chance that some user wants to use move_if_noexcept for move assignments as well, not just move constructions. But the conditional just checks for a throwing move construction. Now, I realize that for most move-enabled types nothrow_move_constructible&lt;T&gt; will be equal to nothrow_move_assignable&lt;T&gt; but it is also possibe to write a class where only one of these operations throws and the other one doesn&#8217;t. Consider a type with a non-throwing move ctor but a throwing move assignment. This definition of move_if_noexcept will allow a throwing move assignment in this case.</p>

<p>What about this one?</p>

<pre>template &lt;class T&gt;
 typename conditional&lt;
     nothrow_move_constructible&lt;T&gt;::value
     &amp;&amp; nothrow_move_assignable&lt;T&gt;::value,
     T&amp;&amp;
     T const&amp;,
 &gt;::type
 move_if_noexcept&#040;T&amp; x&#041;
 &#123;
     return std::move&#040;x&#041;;
 &#125;
&nbsp;</pre>

<p>This implementation honors its contract. It only returns an rvalue reference if both operations (move construction and move assignment) don&#8217;t throw. In rare cases it&#8217;ll decrease performance due to being a little more conservative. But I think that&#8217;s acceptable. It&#8217;ll also lead to some code being rejected. There just isn&#8217;t anything you can do about move-only types with a throwing move, is there?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thomas Petit</title>
		<link>http://cpp-next.com/archive/2009/10/exceptionally-moving/comment-page-1/#comment-237</link>
		<dc:creator>Thomas Petit</dc:creator>
		<pubDate>Fri, 04 Dec 2009 10:17:17 +0000</pubDate>
		<guid isPermaLink="false">http://cpp-next.com/?p=621#comment-237</guid>
		<description>&lt;p&gt;Woohoo, thanks !&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Woohoo, thanks !</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Abrahams</title>
		<link>http://cpp-next.com/archive/2009/10/exceptionally-moving/comment-page-1/#comment-236</link>
		<dc:creator>Dave Abrahams</dc:creator>
		<pubDate>Fri, 04 Dec 2009 06:15:25 +0000</pubDate>
		<guid isPermaLink="false">http://cpp-next.com/?p=621#comment-236</guid>
		<description>&lt;p&gt;Hey, I&#039;m in Shanghai at &lt;a href=&quot;http://china-cpp.org&quot; rel=&quot;nofollow&quot;&gt;a conference&lt;/a&gt;, but I promise I&#039;ll get to this as soon as I get back, next week, if not sooner.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hey, I&#8217;m in Shanghai at <a href="http://china-cpp.org" rel="nofollow">a conference</a>, but I promise I&#8217;ll get to this as soon as I get back, next week, if not sooner.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thomas Petit</title>
		<link>http://cpp-next.com/archive/2009/10/exceptionally-moving/comment-page-1/#comment-235</link>
		<dc:creator>Thomas Petit</dc:creator>
		<pubDate>Tue, 01 Dec 2009 11:45:10 +0000</pubDate>
		<guid isPermaLink="false">http://cpp-next.com/?p=621#comment-235</guid>
		<description>&lt;p&gt;&quot;Next in this series we’ll discuss perfect forwarding&quot;&lt;/p&gt;

&lt;p&gt;Any news ? I&#039;m really eager to see that one. :)&lt;/p&gt;

&lt;p&gt;It&#039;s odd because in all article on rvalue references I saw (including yours so far :)), a big part is always assign to move semantic and very little on perfect forwarding. And yet, I have the feeling that perfect forwarding will be as much important in Ox as move semantic.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>&#8220;Next in this series we’ll discuss perfect forwarding&#8221;</p>

<p>Any news ? I&#8217;m really eager to see that one. <img src='http://cpp-next.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<p>It&#8217;s odd because in all article on rvalue references I saw (including yours so far <img src='http://cpp-next.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ), a big part is always assign to move semantic and very little on perfect forwarding. And yet, I have the feeling that perfect forwarding will be as much important in Ox as move semantic.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Abrahams</title>
		<link>http://cpp-next.com/archive/2009/10/exceptionally-moving/comment-page-1/#comment-234</link>
		<dc:creator>Dave Abrahams</dc:creator>
		<pubDate>Wed, 18 Nov 2009 02:07:28 +0000</pubDate>
		<guid isPermaLink="false">http://cpp-next.com/?p=621#comment-234</guid>
		<description>&lt;blockquote cite=&quot;comment-282&quot;&gt;

&lt;strong&gt;&lt;a href=&quot;#comment-282&quot; rel=&quot;nofollow&quot;&gt;akrzemi1&lt;/a&gt;&lt;/strong&gt;: Hi,
In the first article of this series, you promised to provide the definition of Value Semantics. I would be very interested if there was any strict definition of the concept.
&lt;/blockquote&gt;

&lt;p&gt;I&#039;m sure there are several floating around out there.  I&#039;m less sure that I would agree with any of them :-)&lt;/p&gt;

&lt;blockquote cite=&quot;comment-282&quot;&gt;
I thought that I ‘feel’ what it is but when I once thought of the definition it all becomes vague. I can think of at least three:&lt;ol&gt;
&lt;li&gt;Using copy/move constructor, copy/move assignment and operator==/!= properly.&lt;/li&gt;
&lt;li&gt;Objects (of user defined types) represent values that can be copied, and compared.&lt;/li&gt;
&lt;li&gt;We pass arguments to functions and return from functions by value.&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;

&lt;p&gt;Those are all in the right ballpark as far as I&#039;m concerned.&lt;/p&gt;

&lt;blockquote cite=&quot;comment-282&quot;&gt;
Therefore, a number of questions arise regarding the name ‘Value Semantics’:&lt;ol&gt;
&lt;li&gt;Is it applicable only to languages of C family (C++, D, Java, C#)?&lt;/li&gt;
&lt;li&gt;Is it correct that objects in Java support value semantics, because we have: copy constructor and methods clone and equals, which provide copying and comparison?&lt;/li&gt;
&lt;/ol&gt;
I was wondering if I could request an article on the definition of Value Semantics.
&lt;/blockquote&gt;

&lt;p&gt;You can certainly request, and we do intend to fulfill all of our promises, eventually ;-)
Unfortunately, I haven&#039;t thought all the issues through quite enough yet to write that article today.  However, I can address your two questions above:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Actually, of the above only C++ really supports what I mean by value semantics.  Here&#039;s a crucial test: can you write a &lt;em&gt;mutable&lt;/em&gt; Matrix type that has the usual copy, assignment, etc. semantics?  Of crucial importance is that in this example,&lt;/p&gt;


&lt;pre&gt;1
2
&lt;/pre&gt;&lt;pre&gt;Matrix x = y;
y&#091;0&#093;&#091;0&#093; = 3.14;&lt;/pre&gt;



&lt;p&gt;the value of &lt;code&gt;x&lt;/code&gt; is not modified by line 2.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For me, syntax matters.  Copying an object via &lt;code&gt;y = x.clone()&lt;/code&gt; and especially comparing objects with x.equals(y) don&#039;t count :-)&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
</description>
		<content:encoded><![CDATA[<blockquote cite="comment-282">

<strong><a href="#comment-282" rel="nofollow">akrzemi1</a></strong>: Hi,
In the first article of this series, you promised to provide the definition of Value Semantics. I would be very interested if there was any strict definition of the concept.
</blockquote>

<p>I&#8217;m sure there are several floating around out there.  I&#8217;m less sure that I would agree with any of them <img src='http://cpp-next.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>

<blockquote cite="comment-282">
I thought that I ‘feel’ what it is but when I once thought of the definition it all becomes vague. I can think of at least three:<ol>
<li>Using copy/move constructor, copy/move assignment and operator==/!= properly.</li>
<li>Objects (of user defined types) represent values that can be copied, and compared.</li>
<li>We pass arguments to functions and return from functions by value.</li>
</ol>
</blockquote>

<p>Those are all in the right ballpark as far as I&#8217;m concerned.</p>

<blockquote cite="comment-282">
Therefore, a number of questions arise regarding the name ‘Value Semantics’:<ol>
<li>Is it applicable only to languages of C family (C++, D, Java, C#)?</li>
<li>Is it correct that objects in Java support value semantics, because we have: copy constructor and methods clone and equals, which provide copying and comparison?</li>
</ol>
I was wondering if I could request an article on the definition of Value Semantics.
</blockquote>

<p>You can certainly request, and we do intend to fulfill all of our promises, eventually <img src='http://cpp-next.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> 
Unfortunately, I haven&#8217;t thought all the issues through quite enough yet to write that article today.  However, I can address your two questions above:</p>

<ol>
<li><p>Actually, of the above only C++ really supports what I mean by value semantics.  Here&#8217;s a crucial test: can you write a <em>mutable</em> Matrix type that has the usual copy, assignment, etc. semantics?  Of crucial importance is that in this example,</p>


<pre>1
2
</pre><pre>Matrix x = y;
y&#091;0&#093;&#091;0&#093; = 3.14;</pre>



<p>the value of <code>x</code> is not modified by line 2.</p></li>
<li><p>For me, syntax matters.  Copying an object via <code>y = x.clone()</code> and especially comparing objects with x.equals(y) don&#8217;t count <img src='http://cpp-next.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p></li>
</ol>
]]></content:encoded>
	</item>
	<item>
		<title>By: akrzemi1</title>
		<link>http://cpp-next.com/archive/2009/10/exceptionally-moving/comment-page-1/#comment-233</link>
		<dc:creator>akrzemi1</dc:creator>
		<pubDate>Sun, 15 Nov 2009 14:09:33 +0000</pubDate>
		<guid isPermaLink="false">http://cpp-next.com/?p=621#comment-233</guid>
		<description>&lt;p&gt;Hi,
In the first article of this series, you promised to provide the definition of Value Semantics. I would be very interested if there was any strict definition of the concept. I thought that I &#039;feel&#039; what it is but when I once thought of the definition it all becomes vague. I can think of at least three:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Using copy/move constructor, copy/move assignment and operator==/!= properly.&lt;/li&gt;
&lt;li&gt;Objects (of user defined types) represent values that can be copied, and compared.&lt;/li&gt;
&lt;li&gt;We pass arguments to functions and return from functions by value.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Therefore, a number of questions arise regarding the name &#039;Value Semantics&#039;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Is it applicable only to languages of C family (C++, D, Java, C#)?&lt;/li&gt;
&lt;li&gt;Is it correct that objects in Java support value semantics, because we have: copy constructor and methods clone and equals, which provide copying and comparison?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I was wondering if I could request an article on the definition of Value Semantics.&lt;/p&gt;

&lt;p&gt;Regards,
&amp;rzej&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi,
In the first article of this series, you promised to provide the definition of Value Semantics. I would be very interested if there was any strict definition of the concept. I thought that I &#8216;feel&#8217; what it is but when I once thought of the definition it all becomes vague. I can think of at least three:</p>

<ol>
<li>Using copy/move constructor, copy/move assignment and operator==/!= properly.</li>
<li>Objects (of user defined types) represent values that can be copied, and compared.</li>
<li>We pass arguments to functions and return from functions by value.</li>
</ol>

<p>Therefore, a number of questions arise regarding the name &#8216;Value Semantics&#8217;:</p>

<ol>
<li>Is it applicable only to languages of C family (C++, D, Java, C#)?</li>
<li>Is it correct that objects in Java support value semantics, because we have: copy constructor and methods clone and equals, which provide copying and comparison?</li>
</ol>

<p>I was wondering if I could request an article on the definition of Value Semantics.</p>

<p>Regards,
&amp;rzej</p>
]]></content:encoded>
	</item>
</channel>
</rss>

