<?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: C++&#8217;s scoped_ptr and unique_ptr smart pointers</title>
	<atom:link href="http://shatteredterminal.com/2008/11/scoped_ptr-and-unique_ptr-smart-pointers/feed/" rel="self" type="application/rss+xml" />
	<link>http://shatteredterminal.com/2008/11/scoped_ptr-and-unique_ptr-smart-pointers/</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/2008/11/scoped_ptr-and-unique_ptr-smart-pointers/comment-page-1/#comment-1336</link>
		<dc:creator>shards</dc:creator>
		<pubDate>Thu, 04 Feb 2010 13:15:46 +0000</pubDate>
		<guid isPermaLink="false">http://shatteredterminal.com/?p=91#comment-1336</guid>
		<description>You&#039;re perfectly right that there are cases where shared ownership is vital. However, many times shared ownership is really not required with a change of design, most of the time for the better. I guess what I was trying to say is that whenever a shared ownership somehow becomes needed, we should try to determine whether it is really needed.

In your second case, for example. I rarely saw two (or more classes) really needing an actual ownership of the same object, i.e. as a member of the class. Most of the time, 1 class (I really mean object) is the owner of the pointer, and the other object only needs it in a single method or two, and hence not needing to actually &quot;own&quot; the pointer. In this case, I&#039;d pass a naked pointer that clearly indicates that the object receiving the naked pointer is not owning the pointer (but this is my coding convention, yours might vary). Here I make sure that the naked pointer is never stored as a member of any other object (or a callback).

Again, I&#039;m not claiming this to be universal, there are indeed cases where shared ownership is needed.

(And thanks! I didn&#039;t think the article was good. I was just hoping that it&#039;d help beginners. I have had some good helps when I started.)</description>
		<content:encoded><![CDATA[<p>You&#8217;re perfectly right that there are cases where shared ownership is vital. However, many times shared ownership is really not required with a change of design, most of the time for the better. I guess what I was trying to say is that whenever a shared ownership somehow becomes needed, we should try to determine whether it is really needed.</p>
<p>In your second case, for example. I rarely saw two (or more classes) really needing an actual ownership of the same object, i.e. as a member of the class. Most of the time, 1 class (I really mean object) is the owner of the pointer, and the other object only needs it in a single method or two, and hence not needing to actually &#8220;own&#8221; the pointer. In this case, I&#8217;d pass a naked pointer that clearly indicates that the object receiving the naked pointer is not owning the pointer (but this is my coding convention, yours might vary). Here I make sure that the naked pointer is never stored as a member of any other object (or a callback).</p>
<p>Again, I&#8217;m not claiming this to be universal, there are indeed cases where shared ownership is needed.</p>
<p>(And thanks! I didn&#8217;t think the article was good. I was just hoping that it&#8217;d help beginners. I have had some good helps when I started.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Danny77uk</title>
		<link>http://shatteredterminal.com/2008/11/scoped_ptr-and-unique_ptr-smart-pointers/comment-page-1/#comment-1335</link>
		<dc:creator>Danny77uk</dc:creator>
		<pubDate>Thu, 04 Feb 2010 12:53:08 +0000</pubDate>
		<guid isPermaLink="false">http://shatteredterminal.com/?p=91#comment-1335</guid>
		<description>Good article!

&quot;There should be a very, very rare situation where it demands shared ownership of an object. In a good software design, only one object should owned a particular object.&quot;

Actually there are many cases where shared ownership is vital - the command pattern upon which most Undo systems is based relies on the command objects sharing ownership of their pointers for example. You must also often reference the same object amongst many and you must use shared pointers for that (or use .get() and return a bald pointer but then what&#039;s the point in using smart pointers?)</description>
		<content:encoded><![CDATA[<p>Good article!</p>
<p>&#8220;There should be a very, very rare situation where it demands shared ownership of an object. In a good software design, only one object should owned a particular object.&#8221;</p>
<p>Actually there are many cases where shared ownership is vital &#8211; the command pattern upon which most Undo systems is based relies on the command objects sharing ownership of their pointers for example. You must also often reference the same object amongst many and you must use shared pointers for that (or use .get() and return a bald pointer but then what&#8217;s the point in using smart pointers?)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

