<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="http://www.bytemycode.com/rssformat.xsl"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title>byteMyCode: Snippets for shared_ptr</title>
		<link>http://www.bytemycode.com</link>
		<description>Snippets for this tag.</description>
		<pubDate>Wed, 03 Dec 2008 00:13:45 +0000</pubDate>
		<copyright>1998-2008 </copyright>
		<language>en-us</language>
		<image>
		      <link>http://www.bytemycode.com</link>
		      <url>http://www.bytemycode.com/img/rss_title.gif</url>
		      <title>byteMyCode</title>
		</image>

	<item>
	<title>Template function to create a boost::shared_ptr</title>
	<link>http://www.bytemycode.com/snippets/snippet/252/</link>
	<comments>http://www.bytemycode.com/snippets/snippet/252/comments/</comments>
	<pubDate>Thu, 03 Aug 2006 11:54:13 +0000</pubDate>
	<dc:creator>bobbyrward</dc:creator>
	<category>boost, CPlusPlus, preprocessor, shared_ptr</category>
	<guid isPermaLink="false">http://www.bytemycode.com/snippets/snippet/252/</guid>
	<description>
		<![CDATA[

			<img src="http://www.bytemycode.com/img/icon_calendar.gif" align="middle" class="icon" alt="Date Submitted" /> Thu. Aug. 3rd, 2006  11:54 AM			<br />
			<img src="http://www.bytemycode.com/img/icon_revision.gif" align="middle" class="icon" alt="Revision" /> <a href="http://www.bytemycode.com/snippets/snippet/252/revisions/">1</a>
			<br />
			<img src="http://www.bytemycode.com/img/rank_helper.gif" align="middle" class="icon" alt="Helper" /> <a href="http://www.bytemycode.com/members/member/bobbyrward/" title="Helper">bobbyrward</a>
			<br />
			<img src="http://www.bytemycode.com/img/icon_tag.gif" align="middle" class="icon" alt="Tags" /> <a href="http://www.bytemycode.com/tags/tag/boost">boost</a>&nbsp;|&nbsp;<a href="http://www.bytemycode.com/tags/tag/CPlusPlus">CPlusPlus</a>&nbsp;|&nbsp;<a href="http://www.bytemycode.com/tags/tag/preprocessor">preprocessor</a>&nbsp;|&nbsp;<a href="http://www.bytemycode.com/tags/tag/shared_ptr">shared_ptr</a>			<br />
			<img src="http://www.bytemycode.com/img/icon_comments.gif" align="middle" class="icon" alt="Comments" /> <a href="http://www.bytemycode.com/snippets/snippet/252/comments/">0 comments</a>
			<br />
			<img src="http://www.bytemycode.com/img/icon_ranking.gif" align="middle" class="icon" alt="Ranking" /> 10
			<p>template function to create a boost::shared_ptr in the form<br /><br />boost::shared_ptr classPtr = new_ptr(Arg1, Arg2);<br /><br />You can also make new_ptr_access a friend of className and make the constructor and destructor private.  <br /><br />This keeps the end user from:<br /><br />Creating an instance manually on the heap<br />Creating an instance manually on the stack<br />Deleting a shared_ptr manually using "delete get()"<br /></p>
		]]>
	</description>
</item>
	</channel>
</rss>