<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" xml:lang="en" xml:base="http://fsfoundry.org/codefreak/wp-atom.php">
	<title type="text">COdE fr3@K</title>
	<subtitle type="text">Weblog of a lively geek.</subtitle>

	<updated>2009-11-13T05:30:32Z</updated>
	<generator uri="http://wordpress.org/" version="2.8.5">WordPress</generator>

	<link rel="alternate" type="text/html" href="http://fsfoundry.org/codefreak" />
	<id>http://fsfoundry.org/codefreak/feed/atom/</id>
	

			<link rel="license" type="text/html" href="http://creativecommons.org/licenses/by-nc-sa/2.5/" /><logo>http://creativecommons.org/images/public/somerights20.gif</logo><link rel="self" href="http://feeds.feedburner.com/codefreak" type="application/atom+xml" /><feedburner:browserFriendly>This is an XML content feed. It is intended to be viewed in a newsreader or syndicated to another site, subject to copyright and fair use.</feedburner:browserFriendly><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><entry>
		<author>
			<name>fr3@K</name>
						<uri>http://fsfoundry.org/codefreak/</uri>
					</author>
		<title type="html"><![CDATA[What Happens When We Lie to the Compiler?]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/codefreak/~3/6di1S-zsrSY/" />
		<id>http://fsfoundry.org/codefreak/?p=677</id>
		<updated>2009-11-13T05:30:32Z</updated>
		<published>2009-11-13T04:57:05Z</published>
		<category scheme="http://fsfoundry.org/codefreak" term="~" /><category scheme="http://fsfoundry.org/codefreak" term="C++" /><category scheme="http://fsfoundry.org/codefreak" term="commentary" /><category scheme="http://fsfoundry.org/codefreak" term="geeky" />		<summary type="html"><![CDATA[When you lie to your compiler, don&#8217;t be surprised to get results those differ from what you expect.
In this case, the coder promised his/her compiler the value of &#8220;value&#8221; won&#8217;t be changed, as it was declared const.
Therefore our best friend (yes, the compiler) who trusted the coder, thought &#8220;hey, I could cache this value in [...]]]></summary>
		<content type="html" xml:base="http://fsfoundry.org/codefreak/2009/11/13/what-happens-when-we-lie-to-the-compiler/">&lt;p&gt;When you lie to your compiler, don&amp;#8217;t be surprised to get results those differ from what you expect.&lt;/p&gt;
&lt;p&gt;In &lt;a href="http://fourdollars.blogspot.com/2009/11/c-programming-call-by.html"&gt;this case&lt;/a&gt;, the coder promised his/her compiler the value of &amp;#8220;value&amp;#8221; won&amp;#8217;t be changed, as it was declared &lt;code&gt;const&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Therefore our best friend (yes, the compiler) who trusted the coder, thought &amp;#8220;hey, I could cache this value in a register and not fetch it from RAM every time I reference it&amp;#8221;, i.e. optimization.&lt;/p&gt;
&lt;p&gt;If we change the code in the link slightly, so that function &lt;code&gt;funcC&lt;/code&gt; would print &lt;code&gt;*value&lt;/code&gt; before the assignment, one would see that the value of &lt;code&gt;*value&lt;/code&gt; had actually been modified by function &lt;code&gt;funcA&lt;/code&gt;. However, the modification was not visible in &lt;code&gt;main&lt;/code&gt;, because the compiler was lied to as the coder explicitly told it that there would be no modification to &lt;code&gt;value&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;In the body of function &lt;code&gt;funcC&lt;/code&gt;, though &lt;code&gt;value&lt;/code&gt; was declared as a pointer to &lt;code&gt;const&lt;/code&gt; instance, the compiler was smart enough to know it was lied to. There was a &lt;code&gt;const_cast&lt;/code&gt; and a assignment, therefore, the modification to &lt;code&gt;*value&lt;/code&gt; was reflected in the output.&lt;/p&gt;
&lt;br /&gt;&lt;a href="http://fsfoundry.org/codefreak/?p=677#comments" title="Comments on &amp;quot;What Happens When We Lie to the Compiler?&amp;quot;"&gt;&lt;img src="http://fsfoundry.org/codefreak/wp-content/plugins/feed-comments-number/image.php?677" alt="Comments" /&gt;&lt;/a&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/codefreak?a=6di1S-zsrSY:B1N_8ycx7jY:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codefreak?i=6di1S-zsrSY:B1N_8ycx7jY:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>
		<link rel="replies" type="text/html" href="http://fsfoundry.org/codefreak/2009/11/13/what-happens-when-we-lie-to-the-compiler/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://fsfoundry.org/codefreak/2009/11/13/what-happens-when-we-lie-to-the-compiler/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://fsfoundry.org/codefreak/2009/11/13/what-happens-when-we-lie-to-the-compiler/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>fr3@K</name>
						<uri>http://fsfoundry.org/codefreak/</uri>
					</author>
		<title type="html"><![CDATA[Texas Army Base Rampage]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/codefreak/~3/LHLsIbYAJxs/" />
		<id>http://fsfoundry.org/codefreak/?p=668</id>
		<updated>2009-11-05T23:15:17Z</updated>
		<published>2009-11-05T23:11:45Z</published>
		<category scheme="http://fsfoundry.org/codefreak" term="~" /><category scheme="http://fsfoundry.org/codefreak" term="gossip" /><category scheme="http://fsfoundry.org/codefreak" term="mortal" />		<summary type="html"><![CDATA[我的媽呀~~
在舊金山機場等回台北的飛機, 電視上不斷的播放著德州美軍基地內部發生槍擊的新聞.
CNN 目前的說法是: 連同兇手總共掛了 12 個人, 兇嫌是一名現役中校.
]]></summary>
		<content type="html" xml:base="http://fsfoundry.org/codefreak/2009/11/06/texas-army-base-rampage/">&lt;p&gt;我的媽呀~~&lt;/p&gt;
&lt;p&gt;在舊金山機場等回台北的飛機, 電視上不斷的播放著德州美軍基地內部發生&lt;a href="http://edition.cnn.com/2009/US/11/05/texas.fort.hood.shootings/index.html"&gt;槍擊&lt;/a&gt;的&lt;a href="http://www.google.com/hostednews/ap/article/ALeqM5ihGepAkECGoDagETVBMpPb3w7Y3gD9BPKKFG0" rel="lightbox"&gt;新聞&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;CNN 目前的說法是: 連同兇手總共掛了 12 個人, 兇嫌是一名現役中校.&lt;/p&gt;
&lt;br /&gt;&lt;a href="http://fsfoundry.org/codefreak/?p=668#comments" title="Comments on &amp;quot;Texas Army Base Rampage&amp;quot;"&gt;&lt;img src="http://fsfoundry.org/codefreak/wp-content/plugins/feed-comments-number/image.php?668" alt="Comments" /&gt;&lt;/a&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/codefreak?a=LHLsIbYAJxs:QMcOlKuXevY:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codefreak?i=LHLsIbYAJxs:QMcOlKuXevY:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>
		<link rel="replies" type="text/html" href="http://fsfoundry.org/codefreak/2009/11/06/texas-army-base-rampage/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://fsfoundry.org/codefreak/2009/11/06/texas-army-base-rampage/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://fsfoundry.org/codefreak/2009/11/06/texas-army-base-rampage/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>fr3@K</name>
						<uri>http://fsfoundry.org/codefreak/</uri>
					</author>
		<title type="html"><![CDATA[So, You Think C++ is Slower than C]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/codefreak/~3/GbOGEfnsLIk/" />
		<id>http://fsfoundry.org/codefreak/?p=631</id>
		<updated>2009-11-05T23:00:41Z</updated>
		<published>2009-11-05T18:01:40Z</published>
		<category scheme="http://fsfoundry.org/codefreak" term="~" /><category scheme="http://fsfoundry.org/codefreak" term="C++" /><category scheme="http://fsfoundry.org/codefreak" term="english" /><category scheme="http://fsfoundry.org/codefreak" term="geeky" /><category scheme="http://fsfoundry.org/codefreak" term="whining" />		<summary type="html"><![CDATA[It is true that C++ provides programming constructs those consume more CPU cycles than it would when done without higher level of abstractions. But, hey, that&#8217;s the cost of abstractions, why pay when they are not needed?
Stop laying out your C++ design like Java. Avoid inheritance when possible. Don&#8217;t make every member function and destructor [...]]]></summary>
		<content type="html" xml:base="http://fsfoundry.org/codefreak/2009/11/06/so-you-think-cpp-is-slower-than-c/">&lt;p&gt;It is true that C++ provides programming constructs those consume more CPU cycles than it would when done without higher level of abstractions. But, hey, that&amp;#8217;s the cost of abstractions, why pay when they are not needed?&lt;/p&gt;
&lt;p&gt;Stop laying out your C++ design like &lt;a href="http://fsfoundry.org/codefreak/2009/03/03/caffeine-intoxication/"&gt;Java&lt;/a&gt;. &lt;a href="http://fsfoundry.org/codefreak/2007/05/22/avoid-pointer-parameters-and-inheritance/#avoid-inheritance"&gt;Avoid inheritance&lt;/a&gt; when possible. Don&amp;#8217;t make every member function and destructor &lt;code&gt;virtual&lt;/code&gt; without really thinking. They not only increase your run time overhead, they boost the &lt;a href="http://fsfoundry.org/codefreak/2009/05/24/observer-done-differently/"&gt;complexity&lt;/a&gt; (read coupling) of your code like nothing else.&lt;/p&gt;
&lt;p&gt;C++ does every &lt;i&gt;C-style&lt;/i&gt; stuff the same way as C does. Not to mention it is capable of more compile time computation than C. I just fail to see how C++ could be slower than C in run time, seriously.&lt;/p&gt;
&lt;br /&gt;&lt;a href="http://fsfoundry.org/codefreak/?p=631#comments" title="Comments on &amp;quot;So, You Think C++ is Slower than C&amp;quot;"&gt;&lt;img src="http://fsfoundry.org/codefreak/wp-content/plugins/feed-comments-number/image.php?631" alt="Comments" /&gt;&lt;/a&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/codefreak?a=GbOGEfnsLIk:vgIqm2uznPk:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codefreak?i=GbOGEfnsLIk:vgIqm2uznPk:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>
		<link rel="replies" type="text/html" href="http://fsfoundry.org/codefreak/2009/11/06/so-you-think-cpp-is-slower-than-c/#comments" thr:count="1" />
		<link rel="replies" type="application/atom+xml" href="http://fsfoundry.org/codefreak/2009/11/06/so-you-think-cpp-is-slower-than-c/feed/atom/" thr:count="1" />
		<thr:total>1</thr:total>
	<feedburner:origLink>http://fsfoundry.org/codefreak/2009/11/06/so-you-think-cpp-is-slower-than-c/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>fr3@K</name>
						<uri>http://fsfoundry.org/codefreak/</uri>
					</author>
		<title type="html"><![CDATA[Boost.Lexical-Cast Alternatives]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/codefreak/~3/1e0q8vqIffg/" />
		<id>http://fsfoundry.org/codefreak/?p=544</id>
		<updated>2009-09-22T03:05:15Z</updated>
		<published>2009-09-17T13:49:00Z</published>
		<category scheme="http://fsfoundry.org/codefreak" term="~" /><category scheme="http://fsfoundry.org/codefreak" term="boost" /><category scheme="http://fsfoundry.org/codefreak" term="C++" /><category scheme="http://fsfoundry.org/codefreak" term="geeky" />		<summary type="html"><![CDATA[今天稍早, 跟一位同事聊到 Boost 的 lexical_cast. 打開了 Firefox 請出 Google, 想找到能幫助我介紹 lexical_cast 的資源. 意外地, Google 把我帶到讓我賺了介紹獎金, 現在跟我是同事的 Jeff, 談到 lexical_cast 的 文章.
在這篇文字的討論串, Jeff 寫道:
我覺得如果可以用這樣的寫法，那就太好了：
uint32_t ID = lexical_cast&#60;auto&#62;("1234567");
甚至最好是：
template &#60;class From, class To = auto&#62;
To lexical_cast(From s) {...}

uint32_t ID = lexical_cast("1234567");
Jeff Hung


小弟既然收了 Jeff 的好處, 當然得回報一下試著幫忙想想辦法:1
PLAIN TEXT
C++:




#include &#60;sstream&#62;


#include &#60;iostream&#62;


#include &#60;stdexcept&#62;


&#160;


class lexi_cast


&#123;


public:


&#160; template &#60;class Input&#62;


&#160; lexi_cast&#40;const Input&#38; in&#41;


&#160; &#123;


&#160; &#160; [...]]]></summary>
		<content type="html" xml:base="http://fsfoundry.org/codefreak/2009/09/17/boost-lexical-cast-alternatives/">&lt;p&gt;今天稍早, 跟一位同事聊到 Boost 的 &lt;a href="http://www.boost.org/doc/libs/1_40_0/libs/conversion/lexical_cast.htm"&gt;lexical_cast&lt;/a&gt;. 打開了 Firefox 請出 Google, 想找到能幫助我介紹 lexical_cast 的資源. 意外地, Google 把我帶到讓我賺了介紹獎金, 現在跟我是同事的 Jeff, 談到 lexical_cast 的 &lt;a href="http://www.jeffhung.net/blog/articles/jeffhung/1635/" rel="nofollow"&gt;文章&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;在這篇文字的討論串, &lt;a href="http://www.jeffhung.net/blog/articles/jeffhung/1635/#comment-133176" rel="nofollow"&gt;Jeff 寫道&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;我覺得如果可以用這樣的寫法，那就太好了：&lt;/p&gt;
&lt;pre&gt;uint32_t ID = lexical_cast&amp;lt;auto&amp;gt;("1234567");&lt;/pre&gt;
&lt;p&gt;甚至最好是：&lt;/p&gt;
&lt;pre&gt;template &amp;lt;class From, class To = auto&amp;gt;
To lexical_cast(From s) {...}

uint32_t ID = lexical_cast("1234567");&lt;/pre&gt;
&lt;p&gt;Jeff Hung
&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;span id="more-544"&gt;&lt;/span&gt;&lt;br /&gt;
小弟既然收了 Jeff 的好處, 當然得回報一下試著幫忙想想辦法:&lt;sup&gt;&lt;a href="#footnote-1-544" id="footnote-link-1-544" class="footnote-link footnote-identifier-link" title="Sorry, Jeff. 明明是我自己愛玩卻還要遷拖到你."&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
&lt;div class="igBar"&gt;&lt;span id="lcpp-9"&gt;&lt;a href="#" onclick="javascript:showPlainTxt('cpp-9'); return false;"&gt;PLAIN TEXT&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="syntax_hilite"&gt;&lt;span class="langName"&gt;C++:&lt;/span&gt;
&lt;div id="cpp-9"&gt;
&lt;div class="cpp"&gt;
&lt;ol&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #339900;"&gt;#include &amp;lt;sstream&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #339900;"&gt;#include &amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #339900;"&gt;#include &amp;lt;stdexcept&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;class&lt;/span&gt; lexi_cast&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt;:&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;template&lt;/span&gt; &amp;lt;class Input&amp;gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; lexi_cast&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;const&lt;/span&gt; Input&amp;amp; in&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; ss_ &amp;lt;&amp;lt;in;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;!ss_.&lt;span style="color: #00eeff;"&gt;good&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; throw std::&lt;span style="color: #00eeff;"&gt;runtime_error&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #666666;"&gt;"lexi_cast failed"&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;template&lt;/span&gt; &amp;lt;class Output&amp;gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; operator Output&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; Output out;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; ss_&amp;gt;&amp;gt; out;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;ss_.&lt;span style="color: #00eeff;"&gt;bad&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt; || ss_.&lt;span style="color: #00eeff;"&gt;fail&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; throw std::&lt;span style="color: #00eeff;"&gt;runtime_error&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #666666;"&gt;"lexi_cast failed"&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; out;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;private&lt;/span&gt;:&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; std::&lt;span style="color: #00eeff;"&gt;stringstream&lt;/span&gt; ss_;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; main&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;using&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;namespace&lt;/span&gt; std;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #ff0000;"&gt;// Converts C-style string to int.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; i = lexi_cast&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #666666;"&gt;"123"&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000dd;"&gt;cout&lt;/span&gt; &amp;lt;&amp;lt;i &amp;lt;&amp;lt;endl;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #ff0000;"&gt;// Converts int to std::string.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; string s = lexi_cast&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;i&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000dd;"&gt;cout&lt;/span&gt; &amp;lt;&amp;lt;s &amp;lt;&amp;lt;endl;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; &lt;span style="color: #0000dd;color:#800000;"&gt;0&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt; &lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;ul&gt;&lt;em&gt;岔題一下.&lt;/p&gt;
&lt;p&gt;我一直不是很認同, 在 C++ 中, 以不同的規則來命名 class 與 function. 其中一個原因是, 這兩者的分野其實並沒有那麼大. 上面的 &lt;code&gt;lexi_cast&lt;/code&gt; 就是一個很好的例子. 雖然它與 "真正" 的 function 相較仍有細微的不同, 但它的確是設計來讓使用者以 "function 風格" 操作的. 硬是把它的名字取得跟其他 function 格格不入, 豈不是很礙眼?&lt;/p&gt;
&lt;p&gt;從另一個方面來看, 如果一個 class 的設計容易讓人把它錯誤地當作 function 使用, 而必須以命名原則來區分, 其設計者更是應該要好好反省.&lt;/em&gt;&lt;/ul&gt;
&lt;p&gt;看起來這似乎已滿足了 Jeff 的基本需求, 只是這全自動的轉換機制也有它的問題. 有些時候, 不提供更多資訊給 compiler, 就是會有 ambiguity. 例如 stream insertion:&lt;/p&gt;
&lt;div class="igBar"&gt;&lt;span id="lcpp-10"&gt;&lt;a href="#" onclick="javascript:showPlainTxt('cpp-10'); return false;"&gt;PLAIN TEXT&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="syntax_hilite"&gt;&lt;span class="langName"&gt;C++:&lt;/span&gt;
&lt;div id="cpp-10"&gt;
&lt;div class="cpp"&gt;
&lt;ol&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #ff0000;"&gt;// Ambigous! This won't compile!&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000dd;"&gt;cout&lt;/span&gt; &amp;lt;&amp;lt;lexi_cast&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;some_object&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;; &lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Output stream 的 &lt;code&gt;operator&amp;lt;&amp;lt;&lt;/code&gt; 有 &lt;a href="http://www.dinkumware.com/manuals/?manual=compleat&amp;#038;page=ostream.html#operator%3C%3C" rel="nofollow"&gt;很多 overload&lt;/a&gt;. 由於 &lt;code&gt;lexi_cast&lt;/code&gt; 提供了 generic 的 conversion operator, 因此 compiler 會找到多個可行 (viable) 的 overload. 若我們不顯性提示, compiler 會無法決定到底該採用哪個 overload. 這時候, &lt;code&gt;lexi_cast&lt;/code&gt; 的全自動 (或說是缺乏手動指定的) 轉換功能反而變成了一種缺陷.&lt;/p&gt;
&lt;p&gt;Attempt number 2. 簡單的把 &lt;code&gt;lexi_cast&lt;/code&gt; 改成一個可以指定目的形別的 class template, 並配上做自動轉換的 default template parameter (struct &lt;code&gt;auto_deduce&lt;/code&gt;) 以及 specialization:&lt;/p&gt;
&lt;div class="igBar"&gt;&lt;span id="lcpp-11"&gt;&lt;a href="#" onclick="javascript:showPlainTxt('cpp-11'); return false;"&gt;PLAIN TEXT&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="syntax_hilite"&gt;&lt;span class="langName"&gt;C++:&lt;/span&gt;
&lt;div id="cpp-11"&gt;
&lt;div class="cpp"&gt;
&lt;ol&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;struct&lt;/span&gt; auto_deduce &lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;template&lt;/span&gt; &amp;lt;class Output = auto_deduce&amp;gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;class&lt;/span&gt; lexi_cast2&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt;:&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;template&lt;/span&gt; &amp;lt;class Input&amp;gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; lexi_cast2&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;const&lt;/span&gt; Input&amp;amp; in&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; ss_ &amp;lt;&amp;lt;in;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;!ss_.&lt;span style="color: #00eeff;"&gt;good&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; throw std::&lt;span style="color: #00eeff;"&gt;runtime_error&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #666666;"&gt;"lexi_cast2 failed"&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; operator Output&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; Output out;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; ss_&amp;gt;&amp;gt; out;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;ss_.&lt;span style="color: #00eeff;"&gt;bad&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt; || ss_.&lt;span style="color: #00eeff;"&gt;fail&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; throw std::&lt;span style="color: #00eeff;"&gt;runtime_error&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #666666;"&gt;"lexi_cast2 failed"&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; out;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;private&lt;/span&gt;:&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; std::&lt;span style="color: #00eeff;"&gt;stringstream&lt;/span&gt; ss_;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;template&lt;/span&gt; &amp;lt;&amp;gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;class&lt;/span&gt; lexi_cast2&amp;lt;&lt;span style="color: #ff0000; font-style: italic;"&gt;/*Output =*/&lt;/span&gt;auto_deduce&amp;gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt;:&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;template&lt;/span&gt; &amp;lt;class Input&amp;gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; lexi_cast2&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;const&lt;/span&gt; Input&amp;amp; in&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; ss_ &amp;lt;&amp;lt;in;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;!ss_.&lt;span style="color: #00eeff;"&gt;good&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; throw std::&lt;span style="color: #00eeff;"&gt;runtime_error&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #666666;"&gt;"lexi_cast2 failed"&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;template&lt;/span&gt; &amp;lt;class Output&amp;gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; operator Output&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; Output out;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; ss_&amp;gt;&amp;gt; out;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;ss_.&lt;span style="color: #00eeff;"&gt;bad&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt; || ss_.&lt;span style="color: #00eeff;"&gt;fail&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; throw std::&lt;span style="color: #00eeff;"&gt;runtime_error&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #666666;"&gt;"lexi_cast2 failed"&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; out;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;private&lt;/span&gt;:&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; std::&lt;span style="color: #00eeff;"&gt;stringstream&lt;/span&gt; ss_;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;; &lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;效果並不理想. 自動轉換 (default behavior of class template &lt;code&gt;lexi_cast2&lt;/code&gt;) 雖不需要指定 type, 但還是需要角括號 (angled bracket), 用起來醜到爆:&lt;/p&gt;
&lt;div class="igBar"&gt;&lt;span id="lcpp-12"&gt;&lt;a href="#" onclick="javascript:showPlainTxt('cpp-12'); return false;"&gt;PLAIN TEXT&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="syntax_hilite"&gt;&lt;span class="langName"&gt;C++:&lt;/span&gt;
&lt;div id="cpp-12"&gt;
&lt;div class="cpp"&gt;
&lt;ol&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; main&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;using&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;namespace&lt;/span&gt; std;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #ff0000;"&gt;// Note the next (commented) line won't compile,&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #ff0000;"&gt;// int i = lexi_cast2(&amp;quot;123&amp;quot;);&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #ff0000;"&gt;// Angled brackets needed for auto deduction.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #ff0000;"&gt;// Not pretty at all.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; i = lexi_cast2&amp;lt;&amp;gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #666666;"&gt;"123"&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000dd;"&gt;cout&lt;/span&gt; &amp;lt;&amp;lt;i &amp;lt;&amp;lt;endl;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; string s = lexi_cast2&amp;lt;&amp;gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;i&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000dd;"&gt;cout&lt;/span&gt; &amp;lt;&amp;lt;s &amp;lt;&amp;lt;endl;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #ff0000;"&gt;// Now we could specify which &amp;quot;type&amp;quot; to convert to.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000dd;"&gt;cout&lt;/span&gt; &amp;lt;&amp;lt;lexi_cast2&amp;lt;int&amp;gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;s&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt; &amp;lt;&amp;lt;endl;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; &lt;span style="color: #0000dd;color:#800000;"&gt;0&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt; &lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Attempt number 3. 下面的程式中的 class template &lt;code&gt;lexi_cast3_helper&lt;/code&gt; 與 specialization 是從前面的 &lt;code&gt;lexi_cast2&lt;/code&gt; 修改過來的. 只增加了 copy-ctor:&lt;sup&gt;&lt;a href="#footnote-2-544" id="footnote-link-2-544" class="footnote-link footnote-identifier-link" title="由於 IOStream 是不能 copy 的, 因此 lexi_cast3_helper 需要有 copy-ctor 才能 compile. 有趣的是, 因為 RVO 的關係, 這些 copy-ctor 根本沒有 run-time 的用處, 不會被執行到. 可以把它的內容 comment 掉, 甚至亂改, 只要能 compile &amp;amp; link, 仍舊會正常運作."&gt;2&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
&lt;div class="igBar"&gt;&lt;span id="lcpp-13"&gt;&lt;a href="#" onclick="javascript:showPlainTxt('cpp-13'); return false;"&gt;PLAIN TEXT&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="syntax_hilite"&gt;&lt;span class="langName"&gt;C++:&lt;/span&gt;
&lt;div id="cpp-13"&gt;
&lt;div class="cpp"&gt;
&lt;ol&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;template&lt;/span&gt; &amp;lt;class Output&amp;gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;class&lt;/span&gt; lexi_cast3_helper&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt;:&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;template&lt;/span&gt; &amp;lt;class Input&amp;gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; lexi_cast3_helper&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;const&lt;/span&gt; Input&amp;amp; in&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; ss_ &amp;lt;&amp;lt;in;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;!ss_.&lt;span style="color: #00eeff;"&gt;good&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; throw std::&lt;span style="color: #00eeff;"&gt;runtime_error&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #666666;"&gt;"lexi_cast3 failed"&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #ff0000;"&gt;// Copy-ctor. Needed for compilation, but not&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #ff0000;"&gt;// invoked at run-time.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; lexi_cast3_helper&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;const&lt;/span&gt; lexi_cast3_helper&amp;amp; other&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; ss_ &amp;lt;&amp;lt;other.&lt;span style="color: #00eeff;"&gt;ss_&lt;/span&gt;.&lt;span style="color: #00eeff;"&gt;str&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; operator Output&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; Output out;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; ss_&amp;gt;&amp;gt; out;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;ss_.&lt;span style="color: #00eeff;"&gt;bad&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt; || ss_.&lt;span style="color: #00eeff;"&gt;fail&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; throw std::&lt;span style="color: #00eeff;"&gt;runtime_error&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #666666;"&gt;"lexi_cast3 failed"&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; out;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;private&lt;/span&gt;:&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; std::&lt;span style="color: #00eeff;"&gt;stringstream&lt;/span&gt; ss_;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;template&lt;/span&gt; &amp;lt;&amp;gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;class&lt;/span&gt; lexi_cast3_helper&amp;lt;&lt;span style="color: #ff0000; font-style: italic;"&gt;/*Output =*/&lt;/span&gt;auto_deduce&amp;gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt;:&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;template&lt;/span&gt; &amp;lt;class Input&amp;gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; lexi_cast3_helper&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;const&lt;/span&gt; Input&amp;amp; in&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; ss_ &amp;lt;&amp;lt;in;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;!ss_.&lt;span style="color: #00eeff;"&gt;good&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; throw std::&lt;span style="color: #00eeff;"&gt;runtime_error&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #666666;"&gt;"lexi_cast3 failed"&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #ff0000;"&gt;// Copy-ctor. Needed for compilation, but not&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #ff0000;"&gt;// invoked at run-time.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; lexi_cast3_helper&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;const&lt;/span&gt; lexi_cast3_helper&amp;amp; other&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; ss_ &amp;lt;&amp;lt;other.&lt;span style="color: #00eeff;"&gt;ss_&lt;/span&gt;.&lt;span style="color: #00eeff;"&gt;str&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;template&lt;/span&gt; &amp;lt;class Output&amp;gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; operator Output&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; Output out;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; ss_&amp;gt;&amp;gt; out;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;ss_.&lt;span style="color: #00eeff;"&gt;bad&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt; || ss_.&lt;span style="color: #00eeff;"&gt;fail&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; throw std::&lt;span style="color: #00eeff;"&gt;runtime_error&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #666666;"&gt;"lexi_cast3 failed"&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; out;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;private&lt;/span&gt;:&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; std::&lt;span style="color: #00eeff;"&gt;stringstream&lt;/span&gt; ss_;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;; &lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;把 &lt;code&gt;lexi_cast3_helper&lt;/code&gt; 搭配上兩個 function template - 兩個 &lt;code&gt;lexi_cast3&lt;/code&gt; 的 overload. 一個用來在自動轉換時躲避角括號 (angled bracket), 另一個讓使用者自行指定轉換的目的形別:&lt;/p&gt;
&lt;div class="igBar"&gt;&lt;span id="lcpp-14"&gt;&lt;a href="#" onclick="javascript:showPlainTxt('cpp-14'); return false;"&gt;PLAIN TEXT&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="syntax_hilite"&gt;&lt;span class="langName"&gt;C++:&lt;/span&gt;
&lt;div id="cpp-14"&gt;
&lt;div class="cpp"&gt;
&lt;ol&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #ff0000;"&gt;// Overload for output type auto deduction.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;template&lt;/span&gt; &amp;lt;class Input&amp;gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;lexi_cast3_helper&amp;lt;auto_deduce&amp;gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; lexi_cast3&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;const&lt;/span&gt; Input&amp;amp; in&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; lexi_cast3_helper&amp;lt;auto_deduce&amp;gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;in&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #ff0000;"&gt;// Overload for user-specified output type.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;template&lt;/span&gt; &amp;lt;class Output, &lt;span style="color: #0000ff;"&gt;class&lt;/span&gt; Input&amp;gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;lexi_cast3_helper&amp;lt;Output&amp;gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; lexi_cast3&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;const&lt;/span&gt; Input&amp;amp; in&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; lexi_cast3_helper&amp;lt;Output&amp;gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;in&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt; &lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;結果是:&lt;/p&gt;
&lt;div class="igBar"&gt;&lt;span id="lcpp-15"&gt;&lt;a href="#" onclick="javascript:showPlainTxt('cpp-15'); return false;"&gt;PLAIN TEXT&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="syntax_hilite"&gt;&lt;span class="langName"&gt;C++:&lt;/span&gt;
&lt;div id="cpp-15"&gt;
&lt;div class="cpp"&gt;
&lt;ol&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; main&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;using&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;namespace&lt;/span&gt; std;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #ff0000;"&gt;// No ugly angled brackets for&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #ff0000;"&gt;// auto deduction of output type.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; i = lexi_cast3&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #666666;"&gt;"123"&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000dd;"&gt;cout&lt;/span&gt; &amp;lt;&amp;lt;i &amp;lt;&amp;lt;endl;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; string s = lexi_cast3&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;i&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000dd;"&gt;cout&lt;/span&gt; &amp;lt;&amp;lt;s &amp;lt;&amp;lt;endl;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #ff0000;"&gt;// User-specified output type.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000dd;"&gt;cout&lt;/span&gt; &amp;lt;&amp;lt;lexi_cast3&amp;lt;int&amp;gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;s&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt; &amp;lt;&amp;lt;endl;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; &lt;span style="color: #0000dd;color:#800000;"&gt;0&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt; &lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;這次看來就像樣多了. 能美美地做自動轉換, 也能自行指定轉換的目的形別.&lt;/p&gt;
&lt;p&gt;The moral of this post - 果然還是 C++ 好玩!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;[Update. Sep 22, 2009]&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Improved and simplified. Per Jeff's &lt;a href="http://fsfoundry.org/codefreak/2009/09/17/boost-lexical-cast-alternatives/comment-page-1/#comment-9641"&gt;request&lt;/a&gt;:&lt;/p&gt;
&lt;div class="igBar"&gt;&lt;span id="lcpp-16"&gt;&lt;a href="#" onclick="javascript:showPlainTxt('cpp-16'); return false;"&gt;PLAIN TEXT&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="syntax_hilite"&gt;&lt;span class="langName"&gt;C++:&lt;/span&gt;
&lt;div id="cpp-16"&gt;
&lt;div class="cpp"&gt;
&lt;ol&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;class&lt;/span&gt; lexi_cast4_helper&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt;:&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;template&lt;/span&gt; &amp;lt;class Input&amp;gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; lexi_cast4_helper&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;const&lt;/span&gt; Input&amp;amp; in&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; ss_ &amp;lt;&amp;lt;in;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;!ss_.&lt;span style="color: #00eeff;"&gt;good&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; throw std::&lt;span style="color: #00eeff;"&gt;runtime_error&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #666666;"&gt;"lexi_cast4 failed"&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #ff0000;"&gt;// Copy-ctor. Needed for compilation, but not&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #ff0000;"&gt;// invoked at run-time.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; lexi_cast4_helper&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;const&lt;/span&gt; lexi_cast4_helper&amp;amp; other&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; ss_ &amp;lt;&amp;lt;other.&lt;span style="color: #00eeff;"&gt;ss_&lt;/span&gt;.&lt;span style="color: #00eeff;"&gt;str&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;template&lt;/span&gt; &amp;lt;class Output&amp;gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; operator Output&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; Output out;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; ss_&amp;gt;&amp;gt; out;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;ss_.&lt;span style="color: #00eeff;"&gt;bad&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt; || ss_.&lt;span style="color: #00eeff;"&gt;fail&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; throw std::&lt;span style="color: #00eeff;"&gt;runtime_error&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #666666;"&gt;"lexi_cast4 failed"&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; out;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;private&lt;/span&gt;:&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; std::&lt;span style="color: #00eeff;"&gt;stringstream&lt;/span&gt; ss_;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #ff0000;"&gt;// Overload for output type auto deduction.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;template&lt;/span&gt; &amp;lt;class Input&amp;gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;lexi_cast4_helper lexi_cast4&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;const&lt;/span&gt; Input&amp;amp; in&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; lexi_cast4_helper&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;in&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #ff0000;"&gt;// Overload for user-specified output type.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #ff0000;"&gt;// Instead of returning conversion helper,&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #ff0000;"&gt;// this version returns output type.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;template&lt;/span&gt; &amp;lt;class Output, &lt;span style="color: #0000ff;"&gt;class&lt;/span&gt; Input&amp;gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;Output lexi_cast4&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;const&lt;/span&gt; Input&amp;amp; in&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; lexi_cast4_helper&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;in&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt; &lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;br /&gt;&lt;a href="http://fsfoundry.org/codefreak/?p=544#comments" title="Comments on &amp;quot;Boost.Lexical-Cast Alternatives&amp;quot;"&gt;&lt;img src="http://fsfoundry.org/codefreak/wp-content/plugins/feed-comments-number/image.php?544" alt="Comments" /&gt;&lt;/a&gt;&lt;ol start="1" class="footnotes"&gt;&lt;li id="footnote-1-544" class="footnote"&gt;Sorry, Jeff. 明明是我自己愛玩卻還要遷拖到你. [&lt;a href="#footnote-link-1-544" class="footnote-link footnote-back-link"&gt;↩&lt;/a&gt;]&lt;/li&gt;&lt;li id="footnote-2-544" class="footnote"&gt;由於 IOStream 是不能 copy 的, 因此 &lt;code&gt;lexi_cast3_helper&lt;/code&gt; 需要有 copy-ctor 才能 compile. 有趣的是, 因為 RVO 的關係, 這些 copy-ctor 根本沒有 run-time 的用處, 不會被執行到. 可以把它的內容 comment 掉, 甚至亂改, 只要能 compile &amp;amp; link, 仍舊會正常運作. [&lt;a href="#footnote-link-2-544" class="footnote-link footnote-back-link"&gt;↩&lt;/a&gt;]&lt;/li&gt;&lt;/ol&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/codefreak?a=1e0q8vqIffg:MTAV4C8rEbg:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codefreak?i=1e0q8vqIffg:MTAV4C8rEbg:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>
		<link rel="replies" type="text/html" href="http://fsfoundry.org/codefreak/2009/09/17/boost-lexical-cast-alternatives/#comments" thr:count="2" />
		<link rel="replies" type="application/atom+xml" href="http://fsfoundry.org/codefreak/2009/09/17/boost-lexical-cast-alternatives/feed/atom/" thr:count="2" />
		<thr:total>2</thr:total>
	<feedburner:origLink>http://fsfoundry.org/codefreak/2009/09/17/boost-lexical-cast-alternatives/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>fr3@K</name>
						<uri>http://fsfoundry.org/codefreak/</uri>
					</author>
		<title type="html"><![CDATA[Server side connection/session lingering]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/codefreak/~3/Uxfb9AmHb5E/" />
		<id>http://fsfoundry.org/codefreak/2009/08/15/server-side-connectionsession-lingering/</id>
		<updated>2009-08-17T02:45:07Z</updated>
		<published>2009-08-15T10:39:24Z</published>
		<category scheme="http://fsfoundry.org/codefreak" term="~" /><category scheme="http://fsfoundry.org/codefreak" term="cited" /><category scheme="http://fsfoundry.org/codefreak" term="geeky" /><category scheme="http://fsfoundry.org/codefreak" term="networking" />		<summary type="html"><![CDATA[A great read on how to properly teardown a connection of synchronous protocols (e.g. HTTP) on the server side.
via: SO_LINGER is not the same as Apache's "lingering close".
]]></summary>
		<content type="html" xml:base="http://fsfoundry.org/codefreak/2009/08/15/server-side-connectionsession-lingering/">&lt;p&gt;A great read on how to &lt;a href="http://alumnit.ca/~apenwarr/log/?m=200908#14" rel="nofollow"&gt;properly teardown a connection&lt;/a&gt; of synchronous protocols (e.g. HTTP) on the server side.&lt;/p&gt;
&lt;p&gt;via: &lt;a href="http://alumnit.ca/~apenwarr/log/?m=200908#14"&gt;SO_LINGER is not the same as Apache's "lingering close"&lt;/a&gt;.&lt;/p&gt;
&lt;br /&gt;&lt;a href="http://fsfoundry.org/codefreak/2009/08/15/server-side-connectionsession-lingering/#comments" title="Comments on &amp;quot;Server side connection/session lingering&amp;quot;"&gt;&lt;img src="http://fsfoundry.org/codefreak/wp-content/plugins/feed-comments-number/image.php?516" alt="Comments" /&gt;&lt;/a&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/codefreak?a=Uxfb9AmHb5E:R5LubtkrwR0:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codefreak?i=Uxfb9AmHb5E:R5LubtkrwR0:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>
		<link rel="replies" type="text/html" href="http://fsfoundry.org/codefreak/2009/08/15/server-side-connectionsession-lingering/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://fsfoundry.org/codefreak/2009/08/15/server-side-connectionsession-lingering/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://fsfoundry.org/codefreak/2009/08/15/server-side-connectionsession-lingering/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>fr3@K</name>
						<uri>http://fsfoundry.org/codefreak/</uri>
					</author>
		<title type="html"><![CDATA[The C++0x &#8220;Remove Concepts&#8221; Decision]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/codefreak/~3/oBq-hPp6EvY/" />
		<id>http://fsfoundry.org/codefreak/?p=510</id>
		<updated>2009-08-12T12:52:37Z</updated>
		<published>2009-08-09T11:24:36Z</published>
		<category scheme="http://fsfoundry.org/codefreak" term="~" /><category scheme="http://fsfoundry.org/codefreak" term="C++" /><category scheme="http://fsfoundry.org/codefreak" term="C++0x" /><category scheme="http://fsfoundry.org/codefreak" term="cited" /><category scheme="http://fsfoundry.org/codefreak" term="geeky" />		<summary type="html"><![CDATA[懶人包 + Bjarne on DDJ (翻譯), from Paramecium.
Great job! Thanks, Keiko.
]]></summary>
		<content type="html" xml:base="http://fsfoundry.org/codefreak/2009/08/09/the-cpp0x-remove-concepts-decision/">&lt;p&gt;&lt;a href="http://keikoblog.blogspot.com/2009/08/c0x-concepts-decision.html"&gt;懶人包 + Bjarne on DDJ (翻譯)&lt;/a&gt;, from &lt;a href="http://keikoblog.blogspot.com/"&gt;Paramecium&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Great job! Thanks, Keiko.&lt;/p&gt;
&lt;br /&gt;&lt;a href="http://fsfoundry.org/codefreak/?p=510#comments" title="Comments on &amp;quot;The C++0x &amp;#8220;Remove Concepts&amp;#8221; Decision&amp;quot;"&gt;&lt;img src="http://fsfoundry.org/codefreak/wp-content/plugins/feed-comments-number/image.php?510" alt="Comments" /&gt;&lt;/a&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/codefreak?a=oBq-hPp6EvY:HFOZep8WUq8:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codefreak?i=oBq-hPp6EvY:HFOZep8WUq8:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>
		<link rel="replies" type="text/html" href="http://fsfoundry.org/codefreak/2009/08/09/the-cpp0x-remove-concepts-decision/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://fsfoundry.org/codefreak/2009/08/09/the-cpp0x-remove-concepts-decision/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://fsfoundry.org/codefreak/2009/08/09/the-cpp0x-remove-concepts-decision/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>fr3@K</name>
						<uri>http://fsfoundry.org/codefreak/</uri>
					</author>
		<title type="html"><![CDATA[Avoid Leading Underscores]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/codefreak/~3/WT_Q-P_4_I0/" />
		<id>http://fsfoundry.org/codefreak/?p=264</id>
		<updated>2009-07-25T10:08:11Z</updated>
		<published>2009-07-25T09:48:52Z</published>
		<category scheme="http://fsfoundry.org/codefreak" term="~" /><category scheme="http://fsfoundry.org/codefreak" term="C++" /><category scheme="http://fsfoundry.org/codefreak" term="geeky" />		<summary type="html"><![CDATA[在很多 code base 裏面都能看到在前面加個 underscore (底線/下滑线) 的 function/macro/variable. 常常是用來暗示某個 name 是 local/private, 有時是用來避免 name collision.

GoF 的經典巨著 Design Patterns 裏面, 以及一個時期的 Herb Sutter (the GURU), 都以在前面加上底線的方式標示 member data.
所有我見過的 Standard Library 的 implementation 不但都以在前面加個 underscore (底線/下滑线) 的方式命名 inclusion guard,1 也多用這方法替 member data 以及非公開的 identifier 起名字. Windows 則更是出了名的有許多在前面加了個 underscore 的標準 (documented) Win32 API.
可是關於 leading underscore, 標準是這麼說的: 2

Each name [...]]]></summary>
		<content type="html" xml:base="http://fsfoundry.org/codefreak/2009/07/25/avoid-leading-underscores/">&lt;p&gt;在很多 code base 裏面都能看到在前面加個 underscore (底線/下滑线) 的 function/macro/variable. 常常是用來&lt;em&gt;暗示&lt;/em&gt;某個 name 是 local/private, 有時是用來避免 name collision.&lt;br /&gt;
&lt;span id="more-264"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;a href="http://hillside.net/patterns/DPBook/GOF.html"&gt;GoF&lt;/a&gt; 的經典巨著 &lt;a href="http://www.amazon.com/gp/product/0201633612/104-6374662-6528705?v=glance&amp;#038;n=283155"&gt;Design Patterns&lt;/a&gt; 裏面, 以及一個時期的 &lt;a href="http://www.gotw.ca/"&gt;Herb Sutter&lt;/a&gt; (the GURU), 都以在前面加上底線的方式標示 member data.&lt;/p&gt;
&lt;p&gt;所有我見過的 Standard Library 的 implementation 不但都以在前面加個 underscore (底線/下滑线) 的方式命名 inclusion guard,&lt;sup&gt;&lt;a href="#footnote-1-264" id="footnote-link-1-264" class="footnote-link footnote-identifier-link" title="以 vector  為例, VC++ 的叫 _VECTOR_. libstdc++ 的是 _GLIBCXX_VECTOR"&gt;1&lt;/a&gt;&lt;/sup&gt; 也多用這方法替 member data 以及非公開的 identifier 起名字. Windows 則更是出了名的有許多在前面加了個 underscore 的標準 (documented) Win32 API.&lt;/p&gt;
&lt;p&gt;可是關於 leading underscore, 標準是這麼說的: &lt;sup&gt;&lt;a href="#footnote-2-264" id="footnote-link-2-264" class="footnote-link footnote-identifier-link" title="C++98 17.4.3.1.2"&gt;2&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;
Each name that begins with an underscore is reserved to the implementation for use as a name in the global namespace.
&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;所有以 underscore 起頭的 identifier 都是保留給 compiler/standard library 實作&lt;em&gt;任意&lt;/em&gt;使用的. 也就是說如果使用者自行定義了這樣的 identifier, 結果是無法預期的. 運氣好, 在 compile 時就得到 compiler error. 倒楣的話 undefined behavior 也不是不可能發生.&lt;/p&gt;
&lt;p&gt;在實踐上, 這樣的 code 有很大的機會可以在你現在使用的 compiler 之下能正常編譯與運作, 但卻不能保證它就能在另一個 compiler (甚至是同一 compiler 的下一個版本) 之下也會得到相同的結果.&lt;sup&gt;&lt;a href="#footnote-3-264" id="footnote-link-3-264" class="footnote-link footnote-identifier-link" title="把 Small 從 Windows port 到 Unix 時就遇到了這樣的問題"&gt;3&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
&lt;p&gt;延伸閱讀: Item 11 of &lt;a href="http://www.gotw.ca/gotw/004.htm"&gt;GotW #4&lt;/a&gt;.&lt;/p&gt;
&lt;br /&gt;&lt;a href="http://fsfoundry.org/codefreak/?p=264#comments" title="Comments on &amp;quot;Avoid Leading Underscores&amp;quot;"&gt;&lt;img src="http://fsfoundry.org/codefreak/wp-content/plugins/feed-comments-number/image.php?264" alt="Comments" /&gt;&lt;/a&gt;&lt;ol start="1" class="footnotes"&gt;&lt;li id="footnote-1-264" class="footnote"&gt;以 &lt;code&gt;vector &lt;/code&gt; 為例, VC++ 的叫 &lt;code&gt;_VECTOR_&lt;/code&gt;. libstdc++ 的是 &lt;code&gt;_GLIBCXX_VECTOR&lt;/code&gt; [&lt;a href="#footnote-link-1-264" class="footnote-link footnote-back-link"&gt;↩&lt;/a&gt;]&lt;/li&gt;&lt;li id="footnote-2-264" class="footnote"&gt;C++98 17.4.3.1.2 [&lt;a href="#footnote-link-2-264" class="footnote-link footnote-back-link"&gt;↩&lt;/a&gt;]&lt;/li&gt;&lt;li id="footnote-3-264" class="footnote"&gt;把 &lt;a href="http://www.compuphase.com/small.htm"&gt;Small&lt;/a&gt; 從 &lt;a href="http://sourceware.org/autobook/autobook/autobook_48.html"&gt;Windows port 到 Unix&lt;/a&gt; 時就遇到了這樣的問題 [&lt;a href="#footnote-link-3-264" class="footnote-link footnote-back-link"&gt;↩&lt;/a&gt;]&lt;/li&gt;&lt;/ol&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/codefreak?a=WT_Q-P_4_I0:G8-_crdxGeI:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codefreak?i=WT_Q-P_4_I0:G8-_crdxGeI:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>
		<link rel="replies" type="text/html" href="http://fsfoundry.org/codefreak/2009/07/25/avoid-leading-underscores/#comments" thr:count="1" />
		<link rel="replies" type="application/atom+xml" href="http://fsfoundry.org/codefreak/2009/07/25/avoid-leading-underscores/feed/atom/" thr:count="1" />
		<thr:total>1</thr:total>
	<feedburner:origLink>http://fsfoundry.org/codefreak/2009/07/25/avoid-leading-underscores/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>fr3@K</name>
						<uri>http://fsfoundry.org/codefreak/</uri>
					</author>
		<title type="html"><![CDATA[日蝕]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/codefreak/~3/KCND_xbx7V8/" />
		<id>http://fsfoundry.org/codefreak/?p=492</id>
		<updated>2009-07-22T03:54:39Z</updated>
		<published>2009-07-22T03:52:15Z</published>
		<category scheme="http://fsfoundry.org/codefreak" term="~" /><category scheme="http://fsfoundry.org/codefreak" term="mortal" /><category scheme="http://fsfoundry.org/codefreak" term="pop-sci" />		<summary type="html"><![CDATA[
老婆被我叫起床拍的照片.
]]></summary>
		<content type="html" xml:base="http://fsfoundry.org/codefreak/2009/07/22/eclipse-in-taipei/">&lt;p&gt;&lt;img src="http://fsfoundry.org/gallery/main.php?g2_view=core.DownloadItem&amp;#038;g2_itemId=8615&amp;#038;g2_serialNumber=3" width=400 /&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://fsfoundry.org/gallery/main.php?g2_itemId=8618"&gt;老婆被我叫起床拍的照片&lt;/a&gt;.&lt;/p&gt;
&lt;br /&gt;&lt;a href="http://fsfoundry.org/codefreak/?p=492#comments" title="Comments on &amp;quot;日蝕&amp;quot;"&gt;&lt;img src="http://fsfoundry.org/codefreak/wp-content/plugins/feed-comments-number/image.php?492" alt="Comments" /&gt;&lt;/a&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/codefreak?a=KCND_xbx7V8:mZsFhLytjhU:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codefreak?i=KCND_xbx7V8:mZsFhLytjhU:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>
		<link rel="replies" type="text/html" href="http://fsfoundry.org/codefreak/2009/07/22/eclipse-in-taipei/#comments" thr:count="4" />
		<link rel="replies" type="application/atom+xml" href="http://fsfoundry.org/codefreak/2009/07/22/eclipse-in-taipei/feed/atom/" thr:count="4" />
		<thr:total>4</thr:total>
	<feedburner:origLink>http://fsfoundry.org/codefreak/2009/07/22/eclipse-in-taipei/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>fr3@K</name>
						<uri>http://fsfoundry.org/codefreak/</uri>
					</author>
		<title type="html"><![CDATA[C++0x &#8211; Concepts Rejected]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/codefreak/~3/bBUuxMv2X8I/" />
		<id>http://fsfoundry.org/codefreak/2009/07/21/c0x-concepts-are-voted-out/</id>
		<updated>2009-07-21T02:45:59Z</updated>
		<published>2009-07-21T02:17:58Z</published>
		<category scheme="http://fsfoundry.org/codefreak" term="~" /><category scheme="http://fsfoundry.org/codefreak" term="C++" /><category scheme="http://fsfoundry.org/codefreak" term="C++0x" /><category scheme="http://fsfoundry.org/codefreak" term="cited" /><category scheme="http://fsfoundry.org/codefreak" term="geeky" />		<summary type="html"><![CDATA[大件事, Concepts 被否決了.
]]></summary>
		<content type="html" xml:base="http://fsfoundry.org/codefreak/2009/07/21/cpp0x-concepts-rejected/">&lt;p&gt;大件事, &lt;a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Concepts"&gt;Concepts&lt;/a&gt; 被&lt;a href="http://www.informit.com/guides/content.aspx?g=cplusplus&amp;#038;seqNum=441"&gt;否決&lt;/a&gt;了.&lt;/p&gt;
&lt;br /&gt;&lt;a href="http://fsfoundry.org/codefreak/2009/07/21/c0x-concepts-are-voted-out/#comments" title="Comments on &amp;quot;C++0x &amp;#8211; Concepts Rejected&amp;quot;"&gt;&lt;img src="http://fsfoundry.org/codefreak/wp-content/plugins/feed-comments-number/image.php?487" alt="Comments" /&gt;&lt;/a&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/codefreak?a=bBUuxMv2X8I:ClSpQRQdHKI:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codefreak?i=bBUuxMv2X8I:ClSpQRQdHKI:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>
		<link rel="replies" type="text/html" href="http://fsfoundry.org/codefreak/2009/07/21/cpp0x-concepts-rejected/#comments" thr:count="1" />
		<link rel="replies" type="application/atom+xml" href="http://fsfoundry.org/codefreak/2009/07/21/cpp0x-concepts-rejected/feed/atom/" thr:count="1" />
		<thr:total>1</thr:total>
	<feedburner:origLink>http://fsfoundry.org/codefreak/2009/07/21/cpp0x-concepts-rejected/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>fr3@K</name>
						<uri>http://fsfoundry.org/codefreak/</uri>
					</author>
		<title type="html"><![CDATA[Status Update, Mid 2009]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/codefreak/~3/ij4HMrHYKsQ/" />
		<id>http://fsfoundry.org/codefreak/?p=377</id>
		<updated>2009-06-28T02:27:45Z</updated>
		<published>2009-06-27T15:59:03Z</published>
		<category scheme="http://fsfoundry.org/codefreak" term="~" /><category scheme="http://fsfoundry.org/codefreak" term="C++" /><category scheme="http://fsfoundry.org/codefreak" term="geeky" />		<summary type="html"><![CDATA[接下來幾個月, 打算把較多的閒暇時間用在一個 "低調計畫" 上. 因此, 預期將減少產出有意義的原創文字.
這個 project 當然是用 C++ 寫些東西. Scope 不大, 因此只要不擺爛, 一個人也一定寫得完. 簡單的說是要 re-implement 一個已存在並被不少人使用的 FOSS project. 將大量使用 Boost. 特別是已經一年多沒碰的 Asio, 以及很可惜一直沒玩到的 Multi-Index. 可以說是拿 Asio 來挑戰 libevent.
如果能較前人的貢獻有更好的 performance 當然最好. 即便不如期望, 也希望可以有機會找出不能 out-perform 的原因或線索. 或許能回饋給 Boost/Asio, 提供改善的方向. 無論如何, this is gonna be fun.
另, 如果你覺得閱讀小弟的文字不算是一件太浪費生命的事, 建議參觀/訂閱我的 Shared Items (via Google Reader).
]]></summary>
		<content type="html" xml:base="http://fsfoundry.org/codefreak/2009/06/27/status-update-mid-2009/">&lt;p&gt;接下來幾個月, 打算把較多的閒暇時間用在一個 "低調計畫" 上. 因此, 預期將減少產出有意義的原創文字.&lt;/p&gt;
&lt;p&gt;這個 project 當然是用 C++ 寫些東西. Scope 不大, 因此只要不擺爛, 一個人也一定寫得完. 簡單的說是要 re-implement 一個已存在並被不少人使用的 FOSS &lt;a href="http://www.danga.com/memcached/" rel="nofollow"&gt;project&lt;/a&gt;. 將大量使用 &lt;a href="http://boost.org" rel="nofollow"&gt;Boost&lt;/a&gt;. 特別是已經一年多沒碰的 &lt;a href="http://www.boost.org/doc/libs/1_39_0/doc/html/boost_asio.html" rel="nofollow"&gt;Asio&lt;/a&gt;, 以及很可惜一直沒玩到的 &lt;a href="http://www.boost.org/doc/libs/1_39_0/libs/multi_index/doc/index.html" rel="nofollow"&gt;Multi-Index&lt;/a&gt;. 可以說是拿 Asio 來挑戰 &lt;a href="http://www.monkey.org/~provos/libevent/" rel="nofollow"&gt;libevent&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;如果能較前人的貢獻有更好的 performance 當然最好. 即便不如期望, 也希望可以有機會找出不能 out-perform 的原因或線索. 或許能回饋給 Boost/Asio, 提供改善的方向. 無論如何, this is gonna be fun.&lt;/p&gt;
&lt;p&gt;另, 如果你覺得閱讀小弟的文字不算是一件太浪費生命的事, 建議參觀/訂閱我的 &lt;a href="http://www.google.com/reader/shared/user/15909074279984661889/state/com.google/broadcast" rel="nofollow"&gt;Shared Items&lt;/a&gt; (via Google Reader).&lt;/p&gt;
&lt;br /&gt;&lt;a href="http://fsfoundry.org/codefreak/?p=377#comments" title="Comments on &amp;quot;Status Update, Mid 2009&amp;quot;"&gt;&lt;img src="http://fsfoundry.org/codefreak/wp-content/plugins/feed-comments-number/image.php?377" alt="Comments" /&gt;&lt;/a&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/codefreak?a=ij4HMrHYKsQ:jQWSMd3c-DI:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codefreak?i=ij4HMrHYKsQ:jQWSMd3c-DI:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>
		<link rel="replies" type="text/html" href="http://fsfoundry.org/codefreak/2009/06/27/status-update-mid-2009/#comments" thr:count="3" />
		<link rel="replies" type="application/atom+xml" href="http://fsfoundry.org/codefreak/2009/06/27/status-update-mid-2009/feed/atom/" thr:count="3" />
		<thr:total>3</thr:total>
	<feedburner:origLink>http://fsfoundry.org/codefreak/2009/06/27/status-update-mid-2009/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>fr3@K</name>
						<uri>http://fsfoundry.org/codefreak/</uri>
					</author>
		<title type="html"><![CDATA[STL Performance Boost in VS2010]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/codefreak/~3/vh1UD_HgCgI/" />
		<id>http://fsfoundry.org/codefreak/?p=348</id>
		<updated>2009-06-29T07:54:06Z</updated>
		<published>2009-06-27T14:18:32Z</published>
		<category scheme="http://fsfoundry.org/codefreak" term="~" /><category scheme="http://fsfoundry.org/codefreak" term="C++" /><category scheme="http://fsfoundry.org/codefreak" term="C++0x" /><category scheme="http://fsfoundry.org/codefreak" term="cited" /><category scheme="http://fsfoundry.org/codefreak" term="rvalue-references" />		<summary type="html"><![CDATA[幾個月前曾在一篇文字裡寫道: 正確的運用 Rvalue References, 有可能帶來可觀的 performance gain. 前幾天看到 Visual C++ Team Blog 新貼出對 STL (VS2010 vs. VS2008) 的 performance benchmark. 在一個程度上, 該篇文字可以說驗證了這個不只我一個人獨有的看法與對 C++0x 的期待.
Rvalue-References 帶來的 performance boost 或許比不上 Multi-Core STL 來得那麼 "方便", 但絕對是你不會想要錯過的 low hanging fruit.
C++0x 的巨浪就要來了, 你準備好了嗎?
]]></summary>
		<content type="html" xml:base="http://fsfoundry.org/codefreak/2009/06/27/stl-performance-boost-in-vs2010/">&lt;p&gt;幾個月前曾在一篇文字裡寫道: &lt;a href="http://fsfoundry.org/codefreak/2009/05/19/i-like-to-move-it/"&gt;正確的運用 Rvalue References, 有可能帶來可觀的 performance gain&lt;/a&gt;. 前幾天看到 Visual C++ Team Blog 新貼出對 STL (VS2010 vs. VS2008) 的 performance &lt;a href="http://blogs.msdn.com/vcblog/archive/2009/06/23/stl-performance.aspx" rel="nofollow"&gt;benchmark&lt;/a&gt;. 在一個程度上, 該篇文字可以說驗證了這個不只我一個人獨有的看法與對 &lt;a href="http://fsfoundry.org/codefreak/tag/cpp0x/"&gt;C++0x&lt;/a&gt; 的期待.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://fsfoundry.org/codefreak/tag/rvalue-references/"&gt;Rvalue-References&lt;/a&gt; 帶來的 performance boost 或許比不上 &lt;a href="http://fsfoundry.org/codefreak/2008/04/15/the-free-launch-is-back/"&gt;Multi-Core STL&lt;/a&gt; 來得那麼 "方便", 但絕對是你不會想要錯過的 low hanging fruit.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://fsfoundry.org/codefreak/2008/10/29/incoming-strom-cpp0x/"&gt;C++0x 的巨浪就要來了&lt;/a&gt;, 你準備好了嗎?&lt;/p&gt;
&lt;br /&gt;&lt;a href="http://fsfoundry.org/codefreak/?p=348#comments" title="Comments on &amp;quot;STL Performance Boost in VS2010&amp;quot;"&gt;&lt;img src="http://fsfoundry.org/codefreak/wp-content/plugins/feed-comments-number/image.php?348" alt="Comments" /&gt;&lt;/a&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/codefreak?a=vh1UD_HgCgI:cMwMM3H6B1Q:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codefreak?i=vh1UD_HgCgI:cMwMM3H6B1Q:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>
		<link rel="replies" type="text/html" href="http://fsfoundry.org/codefreak/2009/06/27/stl-performance-boost-in-vs2010/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://fsfoundry.org/codefreak/2009/06/27/stl-performance-boost-in-vs2010/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://fsfoundry.org/codefreak/2009/06/27/stl-performance-boost-in-vs2010/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>fr3@K</name>
						<uri>http://fsfoundry.org/codefreak/</uri>
					</author>
		<title type="html"><![CDATA[Wordpress Installation Upgraded]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/codefreak/~3/OswE9y41DOc/" />
		<id>http://fsfoundry.org/codefreak/?p=357</id>
		<updated>2009-06-25T12:11:49Z</updated>
		<published>2009-06-25T12:08:37Z</published>
		<category scheme="http://fsfoundry.org/codefreak" term="~" /><category scheme="http://fsfoundry.org/codefreak" term="FSfoundry" /><category scheme="http://fsfoundry.org/codefreak" term="geeky" />		<summary type="html"><![CDATA[成功把 wordpress 從 2.3.x 升級到 2.8. 照著 官網上的說明 一步一步做, 過程不算輕鬆但也不困難.
或許是因為本來就很陽春, foundation theme 似乎完全沒有問題, 這下沒那麼急迫需要換 theme 了.
考慮換成 Pixel theme, 慢慢改裝中.
]]></summary>
		<content type="html" xml:base="http://fsfoundry.org/codefreak/2009/06/25/wordpress-installation-upgraded/">&lt;p&gt;成功把 wordpress 從 2.3.x 升級到 2.8. 照著 &lt;a href="http://codex.wordpress.org/Upgrading_WordPress_Extended"&gt;官網上的說明&lt;/a&gt; 一步一步做, 過程不算輕鬆但也不困難.&lt;/p&gt;
&lt;p&gt;或許是因為本來就很陽春, foundation theme 似乎完全沒有問題, 這下沒那麼急迫需要換 theme 了.&lt;/p&gt;
&lt;p&gt;考慮換成 &lt;a href="http://wordpress.org/extend/themes/pixel" rel="nofollow"&gt;Pixel theme&lt;/a&gt;, 慢慢改裝中.&lt;/p&gt;
&lt;br /&gt;&lt;a href="http://fsfoundry.org/codefreak/?p=357#comments" title="Comments on &amp;quot;Wordpress Installation Upgraded&amp;quot;"&gt;&lt;img src="http://fsfoundry.org/codefreak/wp-content/plugins/feed-comments-number/image.php?357" alt="Comments" /&gt;&lt;/a&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/codefreak?a=OswE9y41DOc:7JEtPSQ371M:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codefreak?i=OswE9y41DOc:7JEtPSQ371M:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>
		<link rel="replies" type="text/html" href="http://fsfoundry.org/codefreak/2009/06/25/wordpress-installation-upgraded/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://fsfoundry.org/codefreak/2009/06/25/wordpress-installation-upgraded/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://fsfoundry.org/codefreak/2009/06/25/wordpress-installation-upgraded/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>fr3@K</name>
						<uri>http://fsfoundry.org/codefreak/</uri>
					</author>
		<title type="html"><![CDATA[Blog Pwnd, Again]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/codefreak/~3/8_QZhcxq2M4/" />
		<id>http://fsfoundry.org/codefreak/2009/06/24/blog-pwnd-again/</id>
		<updated>2009-06-24T10:43:22Z</updated>
		<published>2009-06-24T10:43:22Z</published>
		<category scheme="http://fsfoundry.org/codefreak" term="~" /><category scheme="http://fsfoundry.org/codefreak" term="FSfoundry" /><category scheme="http://fsfoundry.org/codefreak" term="geeky" /><category scheme="http://fsfoundry.org/codefreak" term="security" />		<summary type="html"><![CDATA[又被 hack 了, (上一次的紀錄) 這次的狀況跟 這邊 說的一樣. 準備升級至 Wordpress 2.8.
一直用的 foundation theme 早已是個孤兒沒有人維護, 換哪個 theme 才好呢?
]]></summary>
		<content type="html" xml:base="http://fsfoundry.org/codefreak/2009/06/24/blog-pwnd-again/">&lt;p&gt;又被 hack 了, (&lt;a href="http://fsfoundry.org/codefreak/2008/04/06/knock-knock-you-ve-been-hacked/"&gt;上一次的紀錄&lt;/a&gt;) 這次的狀況跟 &lt;a href="http://www.simpleseo.cn/wordpress/wordpress251-hacked" rel="nofollow"&gt;這邊&lt;/a&gt; 說的一樣. 準備升級至 Wordpress 2.8.&lt;/p&gt;
&lt;p&gt;一直用的 foundation theme 早已是個孤兒沒有人維護, 換哪個 theme 才好呢?&lt;/p&gt;
&lt;br /&gt;&lt;a href="http://fsfoundry.org/codefreak/2009/06/24/blog-pwnd-again/#comments" title="Comments on &amp;quot;Blog Pwnd, Again&amp;quot;"&gt;&lt;img src="http://fsfoundry.org/codefreak/wp-content/plugins/feed-comments-number/image.php?349" alt="Comments" /&gt;&lt;/a&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/codefreak?a=8_QZhcxq2M4:2Yl6uirjm94:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codefreak?i=8_QZhcxq2M4:2Yl6uirjm94:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>
		<link rel="replies" type="text/html" href="http://fsfoundry.org/codefreak/2009/06/24/blog-pwnd-again/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://fsfoundry.org/codefreak/2009/06/24/blog-pwnd-again/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://fsfoundry.org/codefreak/2009/06/24/blog-pwnd-again/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>fr3@K</name>
						<uri>http://fsfoundry.org/codefreak/</uri>
					</author>
		<title type="html"><![CDATA[The &#8220;Zw&#8221; Prefix]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/codefreak/~3/ApAiyFppYQE/" />
		<id>http://fsfoundry.org/codefreak/2009/06/04/the-zw-prefix/</id>
		<updated>2009-06-05T03:02:07Z</updated>
		<published>2009-06-04T14:53:50Z</published>
		<category scheme="http://fsfoundry.org/codefreak" term="~" /><category scheme="http://fsfoundry.org/codefreak" term="cited" /><category scheme="http://fsfoundry.org/codefreak" term="english" /><category scheme="http://fsfoundry.org/codefreak" term="geeky" />		<summary type="html"><![CDATA[I've always wondered: What does the "Zw" prefix (of some NT kernel functions) mean?
As it turns out - nothing.
]]></summary>
		<content type="html" xml:base="http://fsfoundry.org/codefreak/2009/06/04/the-zw-prefix/">&lt;p&gt;I've always wondered: What does the "Zw" prefix (of some NT kernel functions) mean?&lt;/p&gt;
&lt;p&gt;As it turns out - &lt;a href="http://blogs.msdn.com/oldnewthing/archive/2009/06/03/9687937.aspx" rel="nofollow"&gt;nothing&lt;/a&gt;.&lt;/p&gt;
&lt;br /&gt;&lt;a href="http://fsfoundry.org/codefreak/2009/06/04/the-zw-prefix/#comments" title="Comments on &amp;quot;The &amp;#8220;Zw&amp;#8221; Prefix&amp;quot;"&gt;&lt;img src="http://fsfoundry.org/codefreak/wp-content/plugins/feed-comments-number/image.php?346" alt="Comments" /&gt;&lt;/a&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/codefreak?a=ApAiyFppYQE:9SqosZ13Ayk:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codefreak?i=ApAiyFppYQE:9SqosZ13Ayk:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>
		<link rel="replies" type="text/html" href="http://fsfoundry.org/codefreak/2009/06/04/the-zw-prefix/#comments" thr:count="5" />
		<link rel="replies" type="application/atom+xml" href="http://fsfoundry.org/codefreak/2009/06/04/the-zw-prefix/feed/atom/" thr:count="5" />
		<thr:total>5</thr:total>
	<feedburner:origLink>http://fsfoundry.org/codefreak/2009/06/04/the-zw-prefix/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>fr3@K</name>
						<uri>http://fsfoundry.org/codefreak/</uri>
					</author>
		<title type="html"><![CDATA[It&#8217;s Better Without Asus]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/codefreak/~3/ePSjd-87aXA/" />
		<id>http://fsfoundry.org/codefreak/2009/05/30/its-better-without-asus/</id>
		<updated>2009-05-30T11:07:02Z</updated>
		<published>2009-05-30T11:05:43Z</published>
		<category scheme="http://fsfoundry.org/codefreak" term="~" /><category scheme="http://fsfoundry.org/codefreak" term="cited" /><category scheme="http://fsfoundry.org/codefreak" term="english" /><category scheme="http://fsfoundry.org/codefreak" term="geeky" />		<summary type="html"><![CDATA[Okay. Asus, this move is not cool.
Perhaps it's better without you, altogether. Bye.
Cited from: The Register.
]]></summary>
		<content type="html" xml:base="http://fsfoundry.org/codefreak/2009/05/30/its-better-without-asus/">&lt;p&gt;Okay. Asus, this move is &lt;a href="http://www.itsbetterwithwindows.com/"&gt;not cool&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Perhaps it's better without you, altogether. Bye.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Cited from: &lt;a href="http://www.theregister.co.uk/2009/05/30/its_better_with_windows/" rel="nofollow"&gt;The Register&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;br /&gt;&lt;a href="http://fsfoundry.org/codefreak/2009/05/30/its-better-without-asus/#comments" title="Comments on &amp;quot;It&amp;#8217;s Better Without Asus&amp;quot;"&gt;&lt;img src="http://fsfoundry.org/codefreak/wp-content/plugins/feed-comments-number/image.php?345" alt="Comments" /&gt;&lt;/a&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/codefreak?a=ePSjd-87aXA:ucpFwTPVgdE:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codefreak?i=ePSjd-87aXA:ucpFwTPVgdE:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>
		<link rel="replies" type="text/html" href="http://fsfoundry.org/codefreak/2009/05/30/its-better-without-asus/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://fsfoundry.org/codefreak/2009/05/30/its-better-without-asus/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://fsfoundry.org/codefreak/2009/05/30/its-better-without-asus/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>fr3@K</name>
						<uri>http://fsfoundry.org/codefreak/</uri>
					</author>
		<title type="html"><![CDATA[Observer Pattern, Done Differently]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/codefreak/~3/o8VVDxFvrsM/" />
		<id>http://fsfoundry.org/codefreak/2009/05/24/observer-done-differently/</id>
		<updated>2009-05-25T18:47:47Z</updated>
		<published>2009-05-24T12:43:59Z</published>
		<category scheme="http://fsfoundry.org/codefreak" term="~" /><category scheme="http://fsfoundry.org/codefreak" term="boost" /><category scheme="http://fsfoundry.org/codefreak" term="C++" /><category scheme="http://fsfoundry.org/codefreak" term="cited" /><category scheme="http://fsfoundry.org/codefreak" term="commentary" /><category scheme="http://fsfoundry.org/codefreak" term="english" /><category scheme="http://fsfoundry.org/codefreak" term="geeky" />		<summary type="html"><![CDATA[In a recent post of Scott Wheeler's - C and C++ are not the same language. He talked about differences between C and C++, and applications of different programming languages (C, C++, Java, Ruby) in his company.
In the post, Wheeler implemented observer pattern in C, C++ and Java, demonstrating some of his points - including [...]]]></summary>
		<content type="html" xml:base="http://fsfoundry.org/codefreak/2009/05/24/observer-done-differently/">&lt;p&gt;In a recent post of Scott Wheeler's - &lt;a href="http://blog.directededge.com/2009/05/21/c-and-c-are-not-the-same-language/"&gt;C and C++ are not the same language&lt;/a&gt;. He talked about differences between C and C++, and applications of different programming languages (C, C++, Java, Ruby) in his company.&lt;/p&gt;
&lt;p&gt;In the post, Wheeler implemented observer pattern in C, C++ and Java, demonstrating some of his points - including how C and C++ are different from each other, and how C++ and Java are actually more alike.&lt;/p&gt;
&lt;p&gt;Though I do agree with Wheeler's conclusion for the most part, I failed to share his view in C, C++ and Java comparison. IMHO, his observer implementation in C++ is rather old school, or should I say it's &lt;a href="http://fsfoundry.org/codefreak/2009/03/03/caffeine-intoxication/"&gt;so Java&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;span id="more-342"&gt;&lt;/span&gt;In C++, oftentimes, there are more than one way to get you from point A to point B, while OO (inheritance) is the one feature that expresses coupling the most. In modern C++, when there is a way to do something without involving inheritance (read "tight coupling"), it is usually &lt;a href="http://fsfoundry.org/codefreak/2007/05/22/avoid-pointer-parameters-and-inheritance/"&gt;appreciated&lt;/a&gt;. One such way to implement the &lt;em&gt;subject&lt;/em&gt; in observer pattern is:&lt;/p&gt;
&lt;ul&gt;
&lt;div id="listing-1"&gt;Listing 1&lt;/div&gt;
&lt;div class="igBar"&gt;&lt;span id="lcpp-20"&gt;&lt;a href="#" onclick="javascript:showPlainTxt('cpp-20'); return false;"&gt;PLAIN TEXT&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="syntax_hilite"&gt;&lt;span class="langName"&gt;C++:&lt;/span&gt;
&lt;div id="cpp-20"&gt;
&lt;div class="cpp"&gt;
&lt;ol&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;class&lt;/span&gt; subject&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt;:&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;void&lt;/span&gt; register_observer&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #0000ff;"&gt;const&lt;/span&gt; boost::&lt;span style="color: #00eeff;"&gt;function&lt;/span&gt;&amp;lt;void &lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&amp;gt;&amp;amp; observer&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; observers_.&lt;span style="color: #00eeff;"&gt;connect&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;observer&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;void&lt;/span&gt; notify_observers&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;const&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; observers_&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;private&lt;/span&gt;:&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; boost::&lt;span style="color: #00eeff;"&gt;signal&lt;/span&gt;&amp;lt;void &lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&amp;gt; observers_;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;; &lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;/ul&gt;
&lt;p&gt;With help from Boost, nothing from &lt;em&gt;subject&lt;/em&gt;, (or the &lt;code&gt;Listener&lt;/code&gt; interface used in Wheeler's implementation) except the signature of expected &lt;em&gt;observers&lt;/em&gt;, are exposed to &lt;em&gt;Observers&lt;/em&gt; (actually, the signature is exposed mostly to programmers). They are decoupled from each other. Next, let's see what types of &lt;em&gt;observers&lt;/em&gt; can be utilized with this &lt;em&gt;subject&lt;/em&gt; implementation:&lt;/p&gt;
&lt;ul&gt;
&lt;div id="listing-2"&gt;Listing 2&lt;/div&gt;
&lt;div class="igBar"&gt;&lt;span id="lcpp-21"&gt;&lt;a href="#" onclick="javascript:showPlainTxt('cpp-21'); return false;"&gt;PLAIN TEXT&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="syntax_hilite"&gt;&lt;span class="langName"&gt;C++:&lt;/span&gt;
&lt;div id="cpp-21"&gt;
&lt;div class="cpp"&gt;
&lt;ol&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;class&lt;/span&gt; foo_observer&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt;:&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;void&lt;/span&gt; notify&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #0000dd;"&gt;cout&lt;/span&gt; &amp;lt;&amp;lt;__PRETTY_FUNCTION__ &amp;lt;&amp;lt;endl;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;class&lt;/span&gt; bar_observer&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;public&lt;/span&gt;:&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; bar_observer&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;unsigned&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; id&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; : id_&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;id&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;void&lt;/span&gt; operator&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #0000dd;"&gt;cout&lt;/span&gt; &amp;lt;&amp;lt;__PRETTY_FUNCTION__ &amp;lt;&amp;lt;&lt;span style="color: #666666;"&gt;'['&lt;/span&gt; &amp;lt;&amp;lt;id_ &amp;lt;&amp;lt;&lt;span style="color: #666666;"&gt;']'&lt;/span&gt; &amp;lt;&amp;lt;endl;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;private&lt;/span&gt;:&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;unsigned&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; id_;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;void&lt;/span&gt; free_observer&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000dd;"&gt;cout&lt;/span&gt; &amp;lt;&amp;lt;__PRETTY_FUNCTION__ &amp;lt;&amp;lt;endl;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt; &lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;/ul&gt;
&lt;p&gt;And how are they put together:&lt;/p&gt;
&lt;ul&gt;
&lt;div id="listing-3"&gt;Listing 3&lt;/div&gt;
&lt;div class="igBar"&gt;&lt;span id="lcpp-22"&gt;&lt;a href="#" onclick="javascript:showPlainTxt('cpp-22'); return false;"&gt;PLAIN TEXT&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="syntax_hilite"&gt;&lt;span class="langName"&gt;C++:&lt;/span&gt;
&lt;div id="cpp-22"&gt;
&lt;div class="cpp"&gt;
&lt;ol&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; main&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; subject sub;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; foo_observer foo;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; bar_observer bar1&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0000dd;color:#800000;"&gt;1&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; sub.&lt;span style="color: #00eeff;"&gt;register_observer&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; boost::&lt;span style="color: #00eeff;"&gt;bind&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&amp;amp;foo_observer::&lt;span style="color: #00eeff;"&gt;notify&lt;/span&gt;, &amp;amp;foo&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; sub.&lt;span style="color: #00eeff;"&gt;register_observer&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;bar1&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; sub.&lt;span style="color: #00eeff;"&gt;register_observer&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;bar_observer&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0000dd;color:#800000;"&gt;2&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; sub.&lt;span style="color: #00eeff;"&gt;register_observer&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&amp;amp;free_observer&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; sub.&lt;span style="color: #00eeff;"&gt;notify_observers&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; &lt;span style="color: #0000dd;color:#800000;"&gt;0&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt; &lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;/ul&gt;
&lt;p&gt;This &lt;em&gt;subject&lt;/em&gt; implementation can be used with &lt;strong&gt;general objects&lt;/strong&gt; (e.g. &lt;code&gt;foo_observer&lt;/code&gt;), &lt;strong&gt;functional objects&lt;/strong&gt; (e.g. &lt;code&gt;bar_observer&lt;/code&gt;), and of course &lt;strong&gt;free functions&lt;/strong&gt; (e.g. &lt;code&gt;free_observer&lt;/code&gt;) and &lt;strong&gt;more&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Don't be mistaken, though his C++ observer implementation is not among the best I've seen, Wheeler's post is nevertheless a good read. Enjoy.&lt;/p&gt;
&lt;p&gt;Full source code: &lt;a href="http://codepad.org/5LvOwk88" rel="nofollow"&gt;observer.cpp&lt;/a&gt;&lt;/p&gt;
&lt;br /&gt;&lt;a href="http://fsfoundry.org/codefreak/2009/05/24/observer-done-differently/#comments" title="Comments on &amp;quot;Observer Pattern, Done Differently&amp;quot;"&gt;&lt;img src="http://fsfoundry.org/codefreak/wp-content/plugins/feed-comments-number/image.php?342" alt="Comments" /&gt;&lt;/a&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/codefreak?a=o8VVDxFvrsM:AU86NOpnIBU:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codefreak?i=o8VVDxFvrsM:AU86NOpnIBU:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>
		<link rel="replies" type="text/html" href="http://fsfoundry.org/codefreak/2009/05/24/observer-done-differently/#comments" thr:count="2" />
		<link rel="replies" type="application/atom+xml" href="http://fsfoundry.org/codefreak/2009/05/24/observer-done-differently/feed/atom/" thr:count="2" />
		<thr:total>2</thr:total>
	<feedburner:origLink>http://fsfoundry.org/codefreak/2009/05/24/observer-done-differently/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>fr3@K</name>
						<uri>http://fsfoundry.org/codefreak/</uri>
					</author>
		<title type="html"><![CDATA[My First JavaScript &#8211; Konami Code]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/codefreak/~3/8WMejRijJ28/" />
		<id>http://fsfoundry.org/codefreak/2009/05/24/my-first-javascript-konami-code/</id>
		<updated>2009-06-08T13:11:18Z</updated>
		<published>2009-05-24T07:50:29Z</published>
		<category scheme="http://fsfoundry.org/codefreak" term="~" /><category scheme="http://fsfoundry.org/codefreak" term="cited" /><category scheme="http://fsfoundry.org/codefreak" term="geeky" /><category scheme="http://fsfoundry.org/codefreak" term="javascript" /><category scheme="http://fsfoundry.org/codefreak" term="konami-code" />		<summary type="html"><![CDATA[上週在我的 feed reader 上看到了個好玩的東西 - Konami Code.
原文作者引用了 jQuery 主站上的一段 JavaScript, 也明白的說了這個 script 的一個缺陷 - 隨著愈多的 keypress, 它會愈跑愈慢:
It’s a bit sloppy, though: the kkeys array will increase in size with every keypress, which means the page will get slower and slower as you press keys.
把 coding style 調整成自己比較習慣的風格, 加上幾行處理過多 user key log 的 code 以修正原文作者所說的問題, 補上了注解. [...]]]></summary>
		<content type="html" xml:base="http://fsfoundry.org/codefreak/2009/05/24/my-first-javascript-konami-code/">&lt;p&gt;上週在我的 feed reader 上看到了個好玩的東西 - &lt;a href="http://www.nicollet.net/2009/05/konami-code/" rel="nofollow" rel="lightbox"&gt;Konami Code&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;原文作者引用了 jQuery 主站上的一段 JavaScript, 也明白的說了這個 script 的一個缺陷 - 隨著愈多的 keypress, 它會愈跑愈慢:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;It’s a bit sloppy, though: the kkeys array will increase in size with every keypress, which means the page will get slower and slower as you press keys.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;span id="more-339"&gt;&lt;/span&gt;把 coding style 調整成自己比較習慣的風格, 加上幾行處理過多 user key log 的 code 以修正原文作者所說的問題, 補上了注解. Here it is, 我的第一個 JavaScript 程式:&lt;/p&gt;
&lt;div id="js" /&gt;
&lt;ul&gt;
&lt;div class="igBar"&gt;&lt;span id="ljavascript-24"&gt;&lt;a href="#" onclick="javascript:showPlainTxt('javascript-24'); return false;"&gt;PLAIN TEXT&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="syntax_hilite"&gt;&lt;span class="langName"&gt;JavaScript:&lt;/span&gt;
&lt;div id="javascript-24"&gt;
&lt;div class="javascript"&gt;
&lt;ol&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000066; font-weight: bold;"&gt;if&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;window.&lt;span style="color: #006600;"&gt;addEventListener&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #003366; font-weight: bold;"&gt;var&lt;/span&gt; target = &lt;span style="color: #3366CC;"&gt;"http://fsfoundry.org/codefreak/2009/05/24/my-first-javascript-konami-code/"&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #003366; font-weight: bold;"&gt;var&lt;/span&gt; konami_code = &lt;span style="color: #3366CC;"&gt;"38,38,40,40,37,39,37,39,66,65"&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #003366; font-weight: bold;"&gt;var&lt;/span&gt; user_key_log = &lt;span style="color: #66cc66;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#93;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #003366; font-weight: bold;"&gt;var&lt;/span&gt; max_keys_to_log = &lt;span style="color: #CC0000;color:#800000;"&gt;10&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; window.&lt;span style="color: #006600;"&gt;addEventListener&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #3366CC;"&gt;"keydown"&lt;/span&gt;,&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #003366; font-weight: bold;"&gt;function&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;ev&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #66cc66;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; user_key_log.&lt;span style="color: #006600;"&gt;push&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;ev.&lt;span style="color: #006600;"&gt;keyCode&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;; &lt;span style="color: #009900; font-style: italic;"&gt;// push_back&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #003366; font-weight: bold;"&gt;var&lt;/span&gt; user_keys = user_key_log.&lt;span style="color: #006600;"&gt;toString&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900; font-style: italic;"&gt;// Searches for konami_code in user_keys.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #000066; font-weight: bold;"&gt;if&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;user_keys.&lt;span style="color: #006600;"&gt;indexOf&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;konami_code&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;&amp;gt;= &lt;span style="color: #CC0000;color:#800000;"&gt;0&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; window.&lt;span style="color: #006600;"&gt;location&lt;/span&gt; = target;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900; font-style: italic;"&gt;// Cleans up user_key_log, if its length out&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900; font-style: italic;"&gt;// numbered max_keys_to_log.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #000066; font-weight: bold;"&gt;while&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;user_key_log.&lt;span style="color: #006600;"&gt;length&lt;/span&gt;&amp;gt; max_keys_to_log&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; user_key_log.&lt;span style="color: #006600;"&gt;shift&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;; &lt;span style="color: #009900; font-style: italic;"&gt;// pop_front&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt;,&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #003366; font-weight: bold;"&gt;true&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #66cc66;"&gt;&amp;#125;&lt;/span&gt; &lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;/ul&gt;
&lt;p&gt;只要你沒把 browser 的 JavaScript 關掉, 在 COdE fr3@K 的任何一頁輸入 &lt;a href="http://zh.wikipedia.org/wiki/%E7%A7%91%E4%B9%90%E7%BE%8E%E7%A7%98%E6%8A%80" rel="nofollow"&gt;上上下下左右左右BA&lt;/a&gt;, 就會把你帶回到這篇文字.&lt;/p&gt;
&lt;p&gt;Tested to work with:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Firefox 3.0.10&lt;/li&gt;
&lt;li&gt;Opera 9.64&lt;/li&gt;
&lt;li&gt;Epiphany Web Browser 2.24.1&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Note: I don't know why, but as the original script from jQuery, my version doesn't work with IE 6 on my XP box at office.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;Something interesting that I can't help wondering, 連我這個從沒認真看過 JavaScript 更別說寫過的人都能在知道問題後稍微 google 一下把這問題修掉, 難道 jQuery 網站的作者是覺得這段 code 純屬搞笑而隨便寫寫嗎?&lt;/p&gt;
&lt;br /&gt;&lt;a href="http://fsfoundry.org/codefreak/2009/05/24/my-first-javascript-konami-code/#comments" title="Comments on &amp;quot;My First JavaScript &amp;#8211; Konami Code&amp;quot;"&gt;&lt;img src="http://fsfoundry.org/codefreak/wp-content/plugins/feed-comments-number/image.php?339" alt="Comments" /&gt;&lt;/a&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/codefreak?a=8WMejRijJ28:ArnfKJW-Xf4:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codefreak?i=8WMejRijJ28:ArnfKJW-Xf4:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>
		<link rel="replies" type="text/html" href="http://fsfoundry.org/codefreak/2009/05/24/my-first-javascript-konami-code/#comments" thr:count="2" />
		<link rel="replies" type="application/atom+xml" href="http://fsfoundry.org/codefreak/2009/05/24/my-first-javascript-konami-code/feed/atom/" thr:count="2" />
		<thr:total>2</thr:total>
	<feedburner:origLink>http://fsfoundry.org/codefreak/2009/05/24/my-first-javascript-konami-code/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>fr3@K</name>
						<uri>http://fsfoundry.org/codefreak/</uri>
					</author>
		<title type="html"><![CDATA[I Like to Move It]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/codefreak/~3/MlPvEf1wIgo/" />
		<id>http://fsfoundry.org/codefreak/2009/05/19/i-like-to-move-it/</id>
		<updated>2009-05-24T15:01:01Z</updated>
		<published>2009-05-19T04:03:20Z</published>
		<category scheme="http://fsfoundry.org/codefreak" term="~" /><category scheme="http://fsfoundry.org/codefreak" term="C++" /><category scheme="http://fsfoundry.org/codefreak" term="C++0x" /><category scheme="http://fsfoundry.org/codefreak" term="geeky" /><category scheme="http://fsfoundry.org/codefreak" term="rvalue-references" /><category scheme="http://fsfoundry.org/codefreak" term="video" />		<summary type="html"><![CDATA[喜愛 C++ 並關心 C++0x 標準的朋友一定會知道, C++0x 引進了許多新的元素. 不但對 Standard Library 有為數眾多的 addition 與 enhancement, 連 core language 都新增了不少東西. 而其中最重要的, 在我看來, 就是 Rvalue References. 即便不理會 C++0x 其他的新玩意 Rvalue References 依然是一個職業 C++ programmer 該要掌握的新 feature. 原因很簡單, 正確的運用 Rvalue References, 有可能帶來可觀的 performance gain.

The Stage
兩週前, 在 一篇文字 中提到了一個因為貪玩寫下的 object 字串化/格式化 utility. 並 預告 了將在另一篇文字討論, 在 C++0x 的標準下如何對這個 utility 進行優化. [...]]]></summary>
		<content type="html" xml:base="http://fsfoundry.org/codefreak/2009/05/19/i-like-to-move-it/">&lt;p&gt;喜愛 C++ 並關心 C++0x 標準的朋友一定會知道, C++0x 引進了許多新的元素. 不但對 Standard Library 有為數眾多的 addition 與 enhancement, 連 core language 都新增了不少東西. 而其中最重要的, 在我看來, 就是 &lt;a href="http://fsfoundry.org/codefreak/tag/rvalue-references/"&gt;Rvalue References&lt;/a&gt;. 即便不理會 C++0x 其他的新玩意 Rvalue References 依然是一個職業 C++ programmer 該要掌握的新 feature. 原因很簡單, 正確的運用 Rvalue References, 有可能帶來可觀的 performance gain.&lt;br /&gt;
&lt;span id="more-340"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;The Stage&lt;/h3&gt;
&lt;p&gt;兩週前, 在 &lt;a href="http://fsfoundry.org/codefreak/2009/05/04/ostream-type-preservation/"&gt;一篇文字&lt;/a&gt; 中提到了一個因為貪玩寫下的 &lt;a href="http://fsfoundry.org/tmp/str.cpp"&gt;object 字串化/格式化 utility&lt;/a&gt;. 並 &lt;a href="http://fsfoundry.org/codefreak/2009/05/04/ostream-type-preservation/#footnote-1-332"&gt;預告&lt;/a&gt; 了將在另一篇文字討論, 在 C++0x 的標準下如何對這個 utility 進行優化. Well, here it is. 先回頭看看原來的 code:&lt;/p&gt;
&lt;ul&gt;
&lt;div id="listing-1"&gt;Listing 1&lt;/div&gt;
&lt;div class="igBar"&gt;&lt;span id="lcpp-29"&gt;&lt;a href="#" onclick="javascript:showPlainTxt('cpp-29'); return false;"&gt;PLAIN TEXT&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="syntax_hilite"&gt;&lt;span class="langName"&gt;C++:&lt;/span&gt;
&lt;div id="cpp-29"&gt;
&lt;div class="cpp"&gt;
&lt;ol&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;template&lt;/span&gt; &amp;lt;class T&amp;gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;string str&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;const&lt;/span&gt; T&amp;amp; x&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; boost::&lt;span style="color: #00eeff;"&gt;lexical_cast&lt;/span&gt;&amp;lt;string&amp;gt;&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;x&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;template&lt;/span&gt; &amp;lt;class T&amp;gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;string operator%&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;string s, &lt;span style="color: #0000ff;"&gt;const&lt;/span&gt; T&amp;amp; x&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; s += str&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;x&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt; &lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;/ul&gt;
&lt;p&gt;這個 utility 包含了兩個 function template. 使用方法如下:&lt;/p&gt;
&lt;ul&gt;
&lt;div id="listing-2"&gt;Listing 2&lt;/div&gt;
&lt;div class="igBar"&gt;&lt;span id="lcpp-30"&gt;&lt;a href="#" onclick="javascript:showPlainTxt('cpp-30'); return false;"&gt;PLAIN TEXT&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="syntax_hilite"&gt;&lt;span class="langName"&gt;C++:&lt;/span&gt;
&lt;div id="cpp-30"&gt;
&lt;div class="cpp"&gt;
&lt;ol&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;string output = str&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0000dd;color:#800000;"&gt;123&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt; % &lt;span style="color: #666666;"&gt;' '&lt;/span&gt; % &lt;span style="color: #666666;"&gt;"abc"&lt;/span&gt;; &lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;/ul&gt;
&lt;p&gt;簡單的說, 使用時需先以 function template &lt;strong&gt;&lt;code&gt;str&lt;/code&gt;&lt;/strong&gt; 觸發這字串化 utility, 接下來以另一個 function template - &lt;strong&gt;&lt;code&gt;operator%&lt;/code&gt;&lt;/strong&gt; - 串接繼續要被字串化的的 object.&lt;/p&gt;
&lt;h3&gt;The Problem&lt;/h3&gt;
&lt;p&gt;你知道簡單如 &lt;a href="#listing-2"&gt;Listing 2&lt;/a&gt; 的 use case 會觸發幾次 &lt;code&gt;string&lt;code&gt; 的建構 (與解構) 嗎? 假設每次 &lt;code&gt;lexical_cast&lt;/code&gt; 的 invocation 只會觸發一次 &lt;code&gt;string&lt;/code&gt; instantiation. 在 compiler 進行了 &lt;a href="http://www.cs.cmu.edu/~gilpin/c++/performance.html#returnvalue"&gt;RVO&lt;/a&gt; 之後, 仍有五次 &lt;code&gt;string&lt;/code&gt; instantiation.&lt;/p&gt;
&lt;p&gt;其中三次是建構從 &lt;code&gt;str/lexical_cast&lt;/code&gt; 傳回的 &lt;code&gt;string&lt;code&gt; object,&lt;sup&gt;&lt;a href="#footnote-1-340" id="footnote-link-1-340" class="footnote-link footnote-identifier-link" title="經過 RVO 之後, 已無法區分 str 與 lexical_cast 傳回的 instance. 兩者融為一體."&gt;1&lt;/a&gt;&lt;/sup&gt; 另外兩次是 &lt;code&gt;operator%&lt;/code&gt; 返回時的 copy construction. 前者可說是無中生有,&lt;sup&gt;&lt;a href="#footnote-2-340" id="footnote-link-2-340" class="footnote-link footnote-identifier-link" title="從沒有 string object 到有 string object."&gt;2&lt;/a&gt;&lt;/sup&gt; 是躲不掉的開銷. 而後者兩次的 construction 雖然一樣是閃不掉, 但在 C++0x 的 Rvalue References 加持下, 其 copy 的 overhead 是可以避開的.&lt;/p&gt;
&lt;h3&gt;The Move&lt;/h3&gt;
&lt;p&gt;C++0x 的 &lt;a href="http://fsfoundry.org/codefreak/tag/rvalue-references/"&gt;Rvalue References&lt;/a&gt; 可說是為了達成 move semantics 而誕生的產物. 這裡的 move, 是把一個 object 管理的 resource 轉移到另外一個 object 身上的動作. 而 move construction, 則是把一個 object 的 resource 讓出來, 以創建另一個 object:&lt;/p&gt;
&lt;ul&gt;
&lt;div id="listing-3"&gt;Listing 3&lt;/div&gt;
&lt;div class="igBar"&gt;&lt;span id="lcpp-31"&gt;&lt;a href="#" onclick="javascript:showPlainTxt('cpp-31'); return false;"&gt;PLAIN TEXT&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="syntax_hilite"&gt;&lt;span class="langName"&gt;C++:&lt;/span&gt;
&lt;div id="cpp-31"&gt;
&lt;div class="cpp"&gt;
&lt;ol&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #ff0000;"&gt;// a function that returns a temporary string.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;string unnamed_source&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;void&lt;/span&gt; move_construction_demo&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #ff0000;"&gt;// move-construct a string using unnamed source.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; string target&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;unnamed_source&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; string named_source&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;...&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #ff0000;"&gt;// move-construct another string using named source;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; string another_target&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;move&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;named_source&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #ff0000;"&gt;// &amp;quot;named_source&amp;quot; is now destructible, but not usable.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #ff0000;"&gt;// Any reference to it may result undefined behavior.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt; &lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;/ul&gt;
&lt;p&gt;請參考在之前的文字介紹過的一個字串 class 的 &lt;a href="http://fsfoundry.org/codefreak/2008/11/16/cpp0x-rvalue-references/#listing-11"&gt;move constructor&lt;/a&gt; 以及 &lt;a href="http://fsfoundry.org/codefreak/2008/11/16/cpp0x-rvalue-references/#listing-13"&gt;&lt;code&gt;move&lt;/code&gt;&lt;/a&gt; function template 的 definition.&lt;/p&gt;
&lt;h3&gt;The Solution&lt;/h3&gt;
&lt;p&gt;有了 Rvalue References, 我們就可以把 &lt;a href="#listing-1"&gt;Listing 1&lt;/a&gt; 的 &lt;code&gt;operator%&lt;/code&gt; template 修改成:&lt;/p&gt;
&lt;ul&gt;
&lt;div id="listing-4"&gt;Listing 4&lt;/div&gt;
&lt;div class="igBar"&gt;&lt;span id="lcpp-32"&gt;&lt;a href="#" onclick="javascript:showPlainTxt('cpp-32'); return false;"&gt;PLAIN TEXT&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="syntax_hilite"&gt;&lt;span class="langName"&gt;C++:&lt;/span&gt;
&lt;div id="cpp-32"&gt;
&lt;div class="cpp"&gt;
&lt;ol&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #0000ff;"&gt;template&lt;/span&gt; &amp;lt;class T&amp;gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;string operator%&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;string s, &lt;span style="color: #0000ff;"&gt;const&lt;/span&gt; T&amp;amp; x&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;color:#26536A;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; move&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;s += str&lt;span style="color: #000000;"&gt;&amp;#40;&lt;/span&gt;x&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #000000;"&gt;&amp;#125;&lt;/span&gt; &lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;/ul&gt;
&lt;p&gt;在這個例子中, 只要在回傳前對 &lt;code&gt;s += str(x)&lt;/code&gt; 的結果 - an lvalue (reference to a string) - 呼叫 &lt;code&gt;move&lt;/code&gt;, 就能把原本的 copy construction 變成 move construction. 當然也避開了 copy 的開銷.&lt;/p&gt;
&lt;p&gt;那為什麼不需要對另外一個 function template - &lt;code&gt;str&lt;/code&gt; - 一併做 move? 由於來源是 rvalue (&lt;code&gt;lexical_cast&lt;/code&gt; 的傳回值), 而 C++0x 的 &lt;code&gt;string&lt;/code&gt; class 也有 move constructor. 在這組合的配合下, &lt;strong&gt;move 會自動發生&lt;/strong&gt;. 即便 &lt;code&gt;string&lt;/code&gt; class 沒有 move ctor, 從 &lt;code&gt;lexical_cast&lt;/code&gt; 傳回的 &lt;code&gt;string&lt;/code&gt; instance 也會被一路 RVO 到 &lt;code&gt;str&lt;/code&gt; 的 caller,&lt;sup&gt;&lt;a href="#footnote-3-340" id="footnote-link-3-340" class="footnote-link footnote-identifier-link" title="至於這樣的 RVO 會不會真的發生, 就要看 compiler 優化的功力了."&gt;3&lt;/a&gt;&lt;/sup&gt; 其效果就跟被 move 了是十分接近的.&lt;/p&gt;
&lt;h3&gt;The Conclusion&lt;/h3&gt;
&lt;p&gt;&lt;a href="http://fsfoundry.org/codefreak/2008/10/29/incoming-strom-cpp0x/"&gt;C++0x 就要來了&lt;/a&gt;. 你能做的最好準備, 就是讓自己熟悉 Rvalue References. 它不是個 fancy feature, 而是能夠實實在在主宰程式的效能的 killer feature.&lt;/p&gt;
&lt;p&gt;當 function 是以 return by value 方式傳回一個 named instance, 請記得: "We like to~~ MOVE IT!!!"&lt;/p&gt;
&lt;div style="text-align: center;"&gt;&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/0x3W6hutEj8&amp;#038;hl=zh_TW&amp;#038;fs=1&amp;#038;rel=0&amp;#038;color1=0x3a3a3a&amp;#038;color2=0x999999"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/0x3W6hutEj8&amp;#038;hl=zh_TW&amp;#038;fs=1&amp;#038;rel=0&amp;#038;color1=0x3a3a3a&amp;#038;color2=0x999999" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;
&lt;p&gt;Full source code: &lt;a href="http://fsfoundry.org/tmp/move-it.cpp"&gt;move-it.cpp&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Compile using g&amp;#43;&amp;#43; 4.3.2: &lt;code&gt;$ g&amp;#43;&amp;#43; -std=c++0x move-it.cpp&lt;/code&gt;&lt;/p&gt;
&lt;br /&gt;&lt;a href="http://fsfoundry.org/codefreak/2009/05/19/i-like-to-move-it/#comments" title="Comments on &amp;quot;I Like to Move It&amp;quot;"&gt;&lt;img src="http://fsfoundry.org/codefreak/wp-content/plugins/feed-comments-number/image.php?340" alt="Comments" /&gt;&lt;/a&gt;&lt;ol start="1" class="footnotes"&gt;&lt;li id="footnote-1-340" class="footnote"&gt;經過 RVO 之後, 已無法區分 &lt;code&gt;str&lt;/code&gt; 與 &lt;code&gt;lexical_cast&lt;/code&gt; 傳回的 instance. 兩者融為一體. [&lt;a href="#footnote-link-1-340" class="footnote-link footnote-back-link"&gt;↩&lt;/a&gt;]&lt;/li&gt;&lt;li id="footnote-2-340" class="footnote"&gt;從沒有 &lt;code&gt;string&lt;/code&gt; object 到有 &lt;code&gt;string&lt;/code&gt; object. [&lt;a href="#footnote-link-2-340" class="footnote-link footnote-back-link"&gt;↩&lt;/a&gt;]&lt;/li&gt;&lt;li id="footnote-3-340" class="footnote"&gt;至於這樣的 RVO 會不會真的發生, 就要看 compiler 優化的功力了. [&lt;a href="#footnote-link-3-340" class="footnote-link footnote-back-link"&gt;↩&lt;/a&gt;]&lt;/li&gt;&lt;/ol&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/codefreak?a=MlPvEf1wIgo:5ql3z6jAgCE:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codefreak?i=MlPvEf1wIgo:5ql3z6jAgCE:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>
		<link rel="replies" type="text/html" href="http://fsfoundry.org/codefreak/2009/05/19/i-like-to-move-it/#comments" thr:count="10" />
		<link rel="replies" type="application/atom+xml" href="http://fsfoundry.org/codefreak/2009/05/19/i-like-to-move-it/feed/atom/" thr:count="10" />
		<thr:total>10</thr:total>
	<feedburner:origLink>http://fsfoundry.org/codefreak/2009/05/19/i-like-to-move-it/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>fr3@K</name>
						<uri>http://fsfoundry.org/codefreak/</uri>
					</author>
		<title type="html"><![CDATA[New Job Openings at Work]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/codefreak/~3/iepAt21eR3o/" />
		<id>http://fsfoundry.org/codefreak/2009/05/07/new-job-openings-at-work/</id>
		<updated>2009-07-02T02:43:54Z</updated>
		<published>2009-05-07T10:34:17Z</published>
		<category scheme="http://fsfoundry.org/codefreak" term="~" /><category scheme="http://fsfoundry.org/codefreak" term="TM" />		<summary type="html"><![CDATA[今天下午老闆的老闆跟我說, 他的手上也就是我現在服務的部門新增了二十個職缺, 並鼓勵我對外宣傳這個招兵買馬的訊息.
工作會是跟我同一個部門, 但應該不會是同一個 可能也有機會來我的 team. 細節還不清楚, 我就這個部門 common 的部份說明.
上班地點在台北市. 部門的主要責任是建置 cloud computing 的 infrastructure, 以及設計研發運行於這個 infrastructure 之上的 framework 與 application.
一定會用到的 hard skill 有:

Unix based. CentOS 5.3 is the choice of development and target platform of my team, choices among teams may vary.
System/network programming.
Proficiency at one or more of the following system programming languages; C, [...]]]></summary>
		<content type="html" xml:base="http://fsfoundry.org/codefreak/2009/05/07/new-job-openings-at-work/">&lt;p&gt;今天下午老闆的老闆跟我說, 他的手上也就是我現在服務的部門新增了二十個職缺, 並鼓勵我對外宣傳這個招兵買馬的訊息.&lt;/p&gt;
&lt;p&gt;工作會是跟我同一個部門, &lt;del datetime="2009-05-08T16:32:01+00:00"&gt;但應該不會是同一個&lt;/del&gt; &lt;ins datetime="2009-05-08T16:32:01+00:00"&gt;可能也有機會來我的&lt;/ins&gt; team. &lt;del datetime="2009-05-08T16:35:21+00:00"&gt;細節還不清楚,&lt;/del&gt; 我就這個部門 common 的部份說明.&lt;/p&gt;
&lt;p&gt;上班地點在台北市. 部門的主要責任是建置 cloud computing 的 infrastructure, 以及設計研發運行於這個 infrastructure 之上的 framework 與 application.&lt;/p&gt;
&lt;p&gt;一定會用到的 hard skill 有:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;big&gt;Unix based&lt;/big&gt;&lt;/strong&gt;. CentOS 5.3 is the choice of development and target platform of my team, choices among teams may vary.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;big&gt;System/network programming&lt;/big&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Proficiency at one or more of the following system programming languages; &lt;strong&gt;&lt;big&gt;C, C++ and Java&lt;/big&gt;&lt;/strong&gt;. There are teams, like mine, which does C++ mostly, and there are other teams those do Java or pure C.&lt;/li&gt;
&lt;li&gt;Familarity with &lt;strong&gt;&lt;big&gt;Free and Open Source Software&lt;/big&gt;&lt;/strong&gt;. It would be foolish and arrogant if we were not to leverage existing and proven FOSS technologies when available. We use FOSS in conformance to their licenses.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;還有一定會加分, 多數人遲早要用到, 但不是每個人都得現在就會的技術:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Knowledge in &lt;strong&gt;&lt;big&gt;networking protocols&lt;/big&gt;&lt;/strong&gt;. General TCP/IP and HTTP in particular. The more the better.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;big&gt;Distributed computing&lt;/big&gt;&lt;/strong&gt;. e.g. distributed filesystem/database, MapReduce.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;big&gt;Relational database&lt;/big&gt;&lt;/strong&gt;. e.g. PostgreSQL, MySQL.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;big&gt;Scripting&lt;/big&gt;&lt;/strong&gt;. Most teams, if not all, use scripts. Just in case if you are curious, my team uses Perl for scripting.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;big&gt;Data mining&lt;/big&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Knowledge in &lt;strong&gt;&lt;big&gt;Information Security&lt;/big&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;不蓋你, 在個人這十年 software engineering 工作職涯裏, 就屬現在服務的公司最把軟體研發當一回事, 員工的福利也最好.&lt;/p&gt;
&lt;p&gt;有興趣, 熱愛挑戰的朋友可以把履歷 email 給我.&lt;sup&gt;&lt;a href="#footnote-1-336" id="footnote-link-1-336" class="footnote-link footnote-identifier-link" title="雖然小弟我沒有錄用與否的決定權, 但可以確保你的履歷被 forward 到正確的人手上, 免去被看不懂的人 filter 掉的風險."&gt;1&lt;/a&gt;&lt;/sup&gt; 也歡迎把這個訊息轉告給其他的朋友. 轉貼時最好以 link 的方式進行, 以方便取得更新資訊.&lt;/p&gt;
&lt;p id="email" /&gt;
連絡方式:&lt;/p&gt;
&lt;ul&gt;
&lt;pre&gt;
echo gsfbl.gtgpvoesz@psh | tr b-za.@ a-z@.
&lt;/pre&gt;
&lt;/ul&gt;
&lt;p&gt;If you can't figure out my email address from the above code, you really shouldn't be emailing me. Sorry.&lt;/p&gt;
&lt;br /&gt;&lt;a href="http://fsfoundry.org/codefreak/2009/05/07/new-job-openings-at-work/#comments" title="Comments on &amp;quot;New Job Openings at Work&amp;quot;"&gt;&lt;img src="http://fsfoundry.org/codefreak/wp-content/plugins/feed-comments-number/image.php?336" alt="Comments" /&gt;&lt;/a&gt;&lt;ol start="1" class="footnotes"&gt;&lt;li id="footnote-1-336" class="footnote"&gt;雖然小弟我沒有錄用與否的決定權, 但可以確保你的履歷被 forward 到正確的人手上, 免去被看不懂的人 filter 掉的風險. [&lt;a href="#footnote-link-1-336" class="footnote-link footnote-back-link"&gt;↩&lt;/a&gt;]&lt;/li&gt;&lt;/ol&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/codefreak?a=iepAt21eR3o:2wqqjQuUNb0:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codefreak?i=iepAt21eR3o:2wqqjQuUNb0:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>
		<link rel="replies" type="text/html" href="http://fsfoundry.org/codefreak/2009/05/07/new-job-openings-at-work/#comments" thr:count="8" />
		<link rel="replies" type="application/atom+xml" href="http://fsfoundry.org/codefreak/2009/05/07/new-job-openings-at-work/feed/atom/" thr:count="8" />
		<thr:total>8</thr:total>
	<feedburner:origLink>http://fsfoundry.org/codefreak/2009/05/07/new-job-openings-at-work/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>fr3@K</name>
						<uri>http://fsfoundry.org/codefreak/</uri>
					</author>
		<title type="html"><![CDATA[Author of NoScript Apologized]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/codefreak/~3/wp0dxyZ9IfE/" />
		<id>http://fsfoundry.org/codefreak/2009/05/07/author-of-noscript-apologized/</id>
		<updated>2009-05-24T13:44:01Z</updated>
		<published>2009-05-07T03:38:56Z</published>
		<category scheme="http://fsfoundry.org/codefreak" term="~" /><category scheme="http://fsfoundry.org/codefreak" term="cited" /><category scheme="http://fsfoundry.org/codefreak" term="english" /><category scheme="http://fsfoundry.org/codefreak" term="firefox" /><category scheme="http://fsfoundry.org/codefreak" term="geeky" /><category scheme="http://fsfoundry.org/codefreak" term="security" />		<summary type="html"><![CDATA[Giorgio (author of NoScript) apologized and explained things from a somewhat different (i.e. his) perspective.
As Giorgio said himself, it was wrong and there is no excuse. Though, from a user's point of view, I do not agree with his doings in this instance. However, from a geek's (i.e. my) point of view, they were not [...]]]></summary>
		<content type="html" xml:base="http://fsfoundry.org/codefreak/2009/05/07/author-of-noscript-apologized/">&lt;p&gt;Giorgio (author of NoScript) &lt;a href="http://hackademix.net/2009/05/04/dear-adblock-plus-and-noscript-users-dear-mozilla-community/"&gt;apologized and explained&lt;/a&gt; things from a somewhat different (i.e. his) perspective.&lt;/p&gt;
&lt;p&gt;As Giorgio said himself, it was wrong and there is no excuse. Though, from a user's point of view, I do not agree with his doings in &lt;a href="http://fsfoundry.org/codefreak/2009/05/05/noscript-gone-bad/"&gt;this instance&lt;/a&gt;. However, from a geek's (i.e. my) point of view, they were not unthinkable.&lt;/p&gt;
&lt;p&gt;My take, Giorgio was hacking, not for the greater good obviously, but there was no intention to takeover the world (or helping bad guys doing so) neither. That is if it is his true thinking that he told us.&lt;/p&gt;
&lt;p&gt;For now, I am keeping NoScript.&lt;/p&gt;
&lt;br /&gt;&lt;a href="http://fsfoundry.org/codefreak/2009/05/07/author-of-noscript-apologized/#comments" title="Comments on &amp;quot;Author of NoScript Apologized&amp;quot;"&gt;&lt;img src="http://fsfoundry.org/codefreak/wp-content/plugins/feed-comments-number/image.php?335" alt="Comments" /&gt;&lt;/a&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/codefreak?a=wp0dxyZ9IfE:jj5KjyFs7J8:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codefreak?i=wp0dxyZ9IfE:jj5KjyFs7J8:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>
		<link rel="replies" type="text/html" href="http://fsfoundry.org/codefreak/2009/05/07/author-of-noscript-apologized/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://fsfoundry.org/codefreak/2009/05/07/author-of-noscript-apologized/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://fsfoundry.org/codefreak/2009/05/07/author-of-noscript-apologized/</feedburner:origLink></entry>
	</feed>
