<?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: Smart Pointer System</title>
	<atom:link href="http://www.rakkar.org/blog/?feed=rss2&#038;p=278" rel="self" type="application/rss+xml" />
	<link>http://www.rakkar.org/blog/?p=278</link>
	<description>Trials of a game developer</description>
	<lastBuildDate>Tue, 20 Jul 2010 22:23:25 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: David Sveningsson</title>
		<link>http://www.rakkar.org/blog/?p=278&#038;cpage=1#comment-13803</link>
		<dc:creator>David Sveningsson</dc:creator>
		<pubDate>Thu, 13 Dec 2007 18:20:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.rakkar.org/blog/?p=278#comment-13803</guid>
		<description>I wouldn&#039;t really call this a smart pointer, what you have implemented is usually just called reference counting. Smart pointers is a wrapper around a regular c/c++ pointer.</description>
		<content:encoded><![CDATA[<p>I wouldn&#8217;t really call this a smart pointer, what you have implemented is usually just called reference counting. Smart pointers is a wrapper around a regular c/c++ pointer.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rak'kar</title>
		<link>http://www.rakkar.org/blog/?p=278&#038;cpage=1#comment-13766</link>
		<dc:creator>Rak'kar</dc:creator>
		<pubDate>Thu, 29 Nov 2007 15:35:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.rakkar.org/blog/?p=278#comment-13766</guid>
		<description>Thanks for the clarification!  Not being able to do forward declarations of pointers is a major drawback.

I read about their system and here&#039;s the summary as I understand it

scoped_ptr is fast.  If the pointer goes out of scope, the object is deleted.  If the object is deleted, the pointer is set to null.  Cannot point to arrays.

scoped_array same as scoped_ptr, but for arrays

shared_ptr is like what I have, but you can have incomplete types and don&#039;t have to have your class derive from anything.  Cannot point to arrays.

shared_array is like shared_ptr for arrays

weak_ptr is a pointer that will be set to null if the object is deleted, but won&#039;t delete the object itself when the pointer goes out of scope.  Also used if shared_ptr would result in cycles

intrusive_ptr like what I have.</description>
		<content:encoded><![CDATA[<p>Thanks for the clarification!  Not being able to do forward declarations of pointers is a major drawback.</p>
<p>I read about their system and here&#8217;s the summary as I understand it</p>
<p>scoped_ptr is fast.  If the pointer goes out of scope, the object is deleted.  If the object is deleted, the pointer is set to null.  Cannot point to arrays.</p>
<p>scoped_array same as scoped_ptr, but for arrays</p>
<p>shared_ptr is like what I have, but you can have incomplete types and don&#8217;t have to have your class derive from anything.  Cannot point to arrays.</p>
<p>shared_array is like shared_ptr for arrays</p>
<p>weak_ptr is a pointer that will be set to null if the object is deleted, but won&#8217;t delete the object itself when the pointer goes out of scope.  Also used if shared_ptr would result in cycles</p>
<p>intrusive_ptr like what I have.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aras PranckeviÄ?ius</title>
		<link>http://www.rakkar.org/blog/?p=278&#038;cpage=1#comment-13765</link>
		<dc:creator>Aras PranckeviÄ?ius</dc:creator>
		<pubDate>Thu, 29 Nov 2007 10:52:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.rakkar.org/blog/?p=278#comment-13765</guid>
		<description>More problems arise because of exception safety. Also if you want to the reference counting to be thread-safe.</description>
		<content:encoded><![CDATA[<p>More problems arise because of exception safety. Also if you want to the reference counting to be thread-safe.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zeux</title>
		<link>http://www.rakkar.org/blog/?p=278&#038;cpage=1#comment-13764</link>
		<dc:creator>Zeux</dc:creator>
		<pubDate>Thu, 29 Nov 2007 07:48:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.rakkar.org/blog/?p=278#comment-13764</guid>
		<description>This code is so called intrusive ptr. It&#039;s the simplest one from refcounted smart pointers, if you look into boost library, you&#039;ll see that their class is just as simple as your is, though more extensible.

However, this approach has some problems:
1. You have to derive from base class - in order to share something simple you&#039;ll have to wrap it into a class that&#039;s derived from base
2. You can&#039;t specify incomplete (forward-declared) class as a type, thus creating unnecessary include-dependencies
3. It is harder for people (in my experience) to use intrusive pointers than pointers with a separate refcount
4. You can&#039;t make a weak pointer easily with intrusive ptr

The reasons why boost has smart pointer are:
1. No matter how simple the code is, it&#039;s better to have a (more or less) standard component than to write a new one
2. It&#039;s definitely not that simple if we&#039;re talking about separate reference counts (shared_ptr in Boost). It&#039;s not rocket science either, but again it&#039;s much better to have a tested version instead of needing to write one.

As much as I don&#039;t like Boost, smart pointers library is one of the best things in it in terms of implementation.</description>
		<content:encoded><![CDATA[<p>This code is so called intrusive ptr. It&#8217;s the simplest one from refcounted smart pointers, if you look into boost library, you&#8217;ll see that their class is just as simple as your is, though more extensible.</p>
<p>However, this approach has some problems:<br />
1. You have to derive from base class &#8211; in order to share something simple you&#8217;ll have to wrap it into a class that&#8217;s derived from base<br />
2. You can&#8217;t specify incomplete (forward-declared) class as a type, thus creating unnecessary include-dependencies<br />
3. It is harder for people (in my experience) to use intrusive pointers than pointers with a separate refcount<br />
4. You can&#8217;t make a weak pointer easily with intrusive ptr</p>
<p>The reasons why boost has smart pointer are:<br />
1. No matter how simple the code is, it&#8217;s better to have a (more or less) standard component than to write a new one<br />
2. It&#8217;s definitely not that simple if we&#8217;re talking about separate reference counts (shared_ptr in Boost). It&#8217;s not rocket science either, but again it&#8217;s much better to have a tested version instead of needing to write one.</p>
<p>As much as I don&#8217;t like Boost, smart pointers library is one of the best things in it in terms of implementation.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
