<?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: Copy and move semantics</title>
	<atom:link href="http://shatteredterminal.com/2009/03/copy-and-move-semantics/feed/" rel="self" type="application/rss+xml" />
	<link>http://shatteredterminal.com/2009/03/copy-and-move-semantics/</link>
	<description>i don't have a tagline yet</description>
	<lastBuildDate>Thu, 16 Dec 2010 12:23:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: shards</title>
		<link>http://shatteredterminal.com/2009/03/copy-and-move-semantics/comment-page-1/#comment-829</link>
		<dc:creator>shards</dc:creator>
		<pubDate>Thu, 05 Nov 2009 03:23:35 +0000</pubDate>
		<guid isPermaLink="false">http://shatteredterminal.com/?p=137#comment-829</guid>
		<description>Yes, you&#039;re perfectly right. I actually have not had to use assignment operator at all recently (a lot of my code disallow copy&amp;assign specifically). But you&#039;re perfectly right, I&#039;ll edit the post to reflect this. (:

Thanks!

P.S. Sorry for the late reply, was extremely busy with work and research to check on the block.</description>
		<content:encoded><![CDATA[<p>Yes, you&#8217;re perfectly right. I actually have not had to use assignment operator at all recently (a lot of my code disallow copy&#038;assign specifically). But you&#8217;re perfectly right, I&#8217;ll edit the post to reflect this. (:</p>
<p>Thanks!</p>
<p>P.S. Sorry for the late reply, was extremely busy with work and research to check on the block.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richie</title>
		<link>http://shatteredterminal.com/2009/03/copy-and-move-semantics/comment-page-1/#comment-204</link>
		<dc:creator>Richie</dc:creator>
		<pubDate>Thu, 18 Jun 2009 21:53:00 +0000</pubDate>
		<guid isPermaLink="false">http://shatteredterminal.com/?p=137#comment-204</guid>
		<description>&lt;blockquote&gt;vector list2 = list;  // Copy-on-assign&lt;/blockquote&gt;

This is not correct. The compiler will treat this line the same way as the first line and use the copy constructor (try it out yourself!). If you want to use the assignment operator you have to split up the declaration and the initialization in two lines.
Here is a small test program:

&lt;pre name=&quot;code&quot; class=&quot;cpp&quot;&gt;#include &lt;iostream&gt;
#include &lt;stdlib&gt;

class Test {
private:
	std::string name;
public:
	Test(std::string name) {
		this-&gt;name = name;	
		std::cout &lt;&lt; name &lt;&lt; &quot;.Test()&quot; &lt;&lt; std::endl;
	}

	Test(const Test&amp; t) {
		name = t.name;
		std::cout &lt;&lt; name &lt;&lt; &quot;.Test(const Test&amp; t)&quot; &lt;&lt; std::endl;
	}

	Test&amp; operator=(const Test&amp; t) {
		name = t.name;
		std::cout &lt;&lt; name &lt;&lt; &quot;.operator=(const Test&amp; t)&quot; &lt;&lt; std::endl;
		return *this;
	}

	~Test() {
		std::cout &lt;&lt; name &lt;&lt; &quot;.~Test()&quot; &lt;&lt; std::endl;
	}
};

int main(int argc, char** argv) {
	Test test1(&quot;test1&quot;);
	Test t2(test1);
	Test t3 = test1;
	t2 = t3;
	return 0;
}&lt;/pre&gt;

It&#039;s a quite strange exceptional rule in C++ and I was quite surprised reading it a few days ago.</description>
		<content:encoded><![CDATA[<blockquote><p>vector list2 = list;  // Copy-on-assign</p></blockquote>
<p>This is not correct. The compiler will treat this line the same way as the first line and use the copy constructor (try it out yourself!). If you want to use the assignment operator you have to split up the declaration and the initialization in two lines.<br />
Here is a small test program:</p>
<pre name="code" class="cpp">#include &lt;iostream&gt;
#include &lt;stdlib&gt;

class Test {
private:
	std::string name;
public:
	Test(std::string name) {
		this-&gt;name = name;
		std::cout &lt;&lt; name &lt;&lt; ".Test()" &lt;&lt; std::endl;
	}

	Test(const Test&amp; t) {
		name = t.name;
		std::cout &lt;&lt; name &lt;&lt; ".Test(const Test&amp; t)" &lt;&lt; std::endl;
	}

	Test&amp; operator=(const Test&amp; t) {
		name = t.name;
		std::cout &lt;&lt; name &lt;&lt; ".operator=(const Test&amp; t)" &lt;&lt; std::endl;
		return *this;
	}

	~Test() {
		std::cout &lt;&lt; name &lt;&lt; ".~Test()" &lt;&lt; std::endl;
	}
};

int main(int argc, char** argv) {
	Test test1("test1");
	Test t2(test1);
	Test t3 = test1;
	t2 = t3;
	return 0;
}</pre>
<p>It&#8217;s a quite strange exceptional rule in C++ and I was quite surprised reading it a few days ago.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Another c++ Blog &#187; Visual C++ Team Blog : decltype: C++0x Features in VC10, Part 3</title>
		<link>http://shatteredterminal.com/2009/03/copy-and-move-semantics/comment-page-1/#comment-124</link>
		<dc:creator>Another c++ Blog &#187; Visual C++ Team Blog : decltype: C++0x Features in VC10, Part 3</dc:creator>
		<pubDate>Tue, 05 May 2009 14:26:08 +0000</pubDate>
		<guid isPermaLink="false">http://shatteredterminal.com/?p=137#comment-124</guid>
		<description>[...] Copy and move semantics [...]</description>
		<content:encoded><![CDATA[<p>[...] Copy and move semantics [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

