<?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: STL Singleton Template</title>
	<atom:link href="http://cc.byexamples.com/2008/06/09/stl-singleton-template/feed/" rel="self" type="application/rss+xml" />
	<link>http://cc.byexamples.com/2008/06/09/stl-singleton-template/</link>
	<description>we share the c/c++ coding by examples</description>
	<lastBuildDate>Wed, 28 Apr 2010 05:19:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Derek</title>
		<link>http://cc.byexamples.com/2008/06/09/stl-singleton-template/comment-page-1/#comment-1943</link>
		<dc:creator>Derek</dc:creator>
		<pubDate>Fri, 09 Oct 2009 20:35:30 +0000</pubDate>
		<guid isPermaLink="false">http://cc.byexamples.com/?p=39#comment-1943</guid>
		<description>Yeah, this doesn&#039;t implement the pattern at all and has nothing to do with STL other than it uses a template and STL uses templates.  A templated singleton implies I can&#039;t construct another object of the type simply by inheriting from that class.  All this does is give you a factory instance method.  This is a great way to legitimize your global variable with a design pattern and reduce your code into a dependency mess.  That this trainwreck shows up in a google top five shows you how little the industry understands design patterns and C++.</description>
		<content:encoded><![CDATA[<p>Yeah, this doesn&#8217;t implement the pattern at all and has nothing to do with STL other than it uses a template and STL uses templates.  A templated singleton implies I can&#8217;t construct another object of the type simply by inheriting from that class.  All this does is give you a factory instance method.  This is a great way to legitimize your global variable with a design pattern and reduce your code into a dependency mess.  That this trainwreck shows up in a google top five shows you how little the industry understands design patterns and C++.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Subash</title>
		<link>http://cc.byexamples.com/2008/06/09/stl-singleton-template/comment-page-1/#comment-1617</link>
		<dc:creator>Subash</dc:creator>
		<pubDate>Wed, 23 Jul 2008 17:17:42 +0000</pubDate>
		<guid isPermaLink="false">http://cc.byexamples.com/?p=39#comment-1617</guid>
		<description>Singleton can be implemented in another way as well. We shall declare a static variable in the class. Then in the constructor(which can be public), we will increment the static variable(which is our object instance). If we see the object count exceeding 1, then we can throw from the constructor. By this you can always new for only once from anywhere it is used, and it serves the rule of singleton.</description>
		<content:encoded><![CDATA[<p>Singleton can be implemented in another way as well. We shall declare a static variable in the class. Then in the constructor(which can be public), we will increment the static variable(which is our object instance). If we see the object count exceeding 1, then we can throw from the constructor. By this you can always new for only once from anywhere it is used, and it serves the rule of singleton.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: &#187; STL Singleton Template A C One: What The World Is Saying About A C One</title>
		<link>http://cc.byexamples.com/2008/06/09/stl-singleton-template/comment-page-1/#comment-1264</link>
		<dc:creator>&#187; STL Singleton Template A C One: What The World Is Saying About A C One</dc:creator>
		<pubDate>Mon, 09 Jun 2008 04:17:22 +0000</pubDate>
		<guid isPermaLink="false">http://cc.byexamples.com/?p=39#comment-1264</guid>
		<description>[...] Singleton Template      Posted in June 8th, 2008  by  in Uncategorized STL Singleton Template Singleton is one of my favorite design pattern, I use it to keep a global information for my [...]</description>
		<content:encoded><![CDATA[<p>[...] Singleton Template      Posted in June 8th, 2008  by  in Uncategorized STL Singleton Template Singleton is one of my favorite design pattern, I use it to keep a global information for my [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kartik</title>
		<link>http://cc.byexamples.com/2008/06/09/stl-singleton-template/comment-page-1/#comment-1261</link>
		<dc:creator>Kartik</dc:creator>
		<pubDate>Mon, 09 Jun 2008 02:08:13 +0000</pubDate>
		<guid isPermaLink="false">http://cc.byexamples.com/?p=39#comment-1261</guid>
		<description>I am guessing this is not a perfect singleton class.

As We can still do MyClass _myClass = new MyClass();

For a class to be singleton, we should make the constructor private. So that we can construct with a createInstance method.

That way, only one instance of class MyClass will be there in the app always.

0.02,
Kartik</description>
		<content:encoded><![CDATA[<p>I am guessing this is not a perfect singleton class.</p>
<p>As We can still do MyClass _myClass = new MyClass();</p>
<p>For a class to be singleton, we should make the constructor private. So that we can construct with a createInstance method.</p>
<p>That way, only one instance of class MyClass will be there in the app always.</p>
<p>0.02,<br />
Kartik</p>
]]></content:encoded>
	</item>
</channel>
</rss>
