<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: 一個 boost::exception 的例子</title>
	<atom:link href="http://blog.hubert.tw/2009/07/08/%e4%b8%80%e5%80%8b-boostexception-%e7%9a%84%e4%be%8b%e5%ad%90/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.hubert.tw/2009/07/08/%e4%b8%80%e5%80%8b-boostexception-%e7%9a%84%e4%be%8b%e5%ad%90/</link>
	<description>Hubert&#039;s Blog</description>
	<lastBuildDate>Mon, 09 Jan 2012 17:40:05 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: av</title>
		<link>http://blog.hubert.tw/2009/07/08/%e4%b8%80%e5%80%8b-boostexception-%e7%9a%84%e4%be%8b%e5%ad%90/comment-page-1/#comment-54262</link>
		<dc:creator>av</dc:creator>
		<pubDate>Mon, 13 Jul 2009 07:46:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.hubert.tw/?p=535#comment-54262</guid>
		<description>而且多 overload 幾次也不花什麼成本，我看 loki 裡也是一堆這樣用的 XD</description>
		<content:encoded><![CDATA[<p>而且多 overload 幾次也不花什麼成本，我看 loki 裡也是一堆這樣用的 XD</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hubert</title>
		<link>http://blog.hubert.tw/2009/07/08/%e4%b8%80%e5%80%8b-boostexception-%e7%9a%84%e4%be%8b%e5%ad%90/comment-page-1/#comment-54261</link>
		<dc:creator>Hubert</dc:creator>
		<pubDate>Wed, 08 Jul 2009 17:09:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.hubert.tw/?p=535#comment-54261</guid>
		<description>謝謝你的回覆 :D

其實我也有想到類似的作法，只是當天早上覺得幾個參數就要 overload 幾次，覺得好像跟我的初衷有點不同。不過後來仔細想了想，其實似乎某些 library 也會限制參數的個數來讓可用性更好吧。也許下次我就直接寫寫看好了，比起用 va_list 跟設定一個固定大小的 buffer，我還寧願多 overload 幾次勒 :D</description>
		<content:encoded><![CDATA[<p>謝謝你的回覆 <img src='http://blog.hubert.tw/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>其實我也有想到類似的作法，只是當天早上覺得幾個參數就要 overload 幾次，覺得好像跟我的初衷有點不同。不過後來仔細想了想，其實似乎某些 library 也會限制參數的個數來讓可用性更好吧。也許下次我就直接寫寫看好了，比起用 va_list 跟設定一個固定大小的 buffer，我還寧願多 overload 幾次勒 <img src='http://blog.hubert.tw/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: av</title>
		<link>http://blog.hubert.tw/2009/07/08/%e4%b8%80%e5%80%8b-boostexception-%e7%9a%84%e4%be%8b%e5%ad%90/comment-page-1/#comment-54260</link>
		<dc:creator>av</dc:creator>
		<pubDate>Wed, 08 Jul 2009 17:03:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.hubert.tw/?p=535#comment-54260</guid>
		<description>ah, 該死，template 的尖角參數又被吃掉了...重貼一次
template＜typename T1＞
void BOOST_THROW_EXCEPTION_STRING(const wchar_t *fmt, const T1 &amp;t1)
{ throw exception with a string from (boost::format(fmt) % t1).str() }

template＜typename T1, T2＞
void BOOST_THROW_EXCEPTION_STRING(const wchar_t *fmt, const T1 &amp;t1, const T2 &amp;t2)
{ throw exception with a string from (boost::format(fmt) % t1 % t2).str() }</description>
		<content:encoded><![CDATA[<p>ah, 該死，template 的尖角參數又被吃掉了&#8230;重貼一次<br />
template＜typename T1＞<br />
void BOOST_THROW_EXCEPTION_STRING(const wchar_t *fmt, const T1 &amp;t1)<br />
{ throw exception with a string from (boost::format(fmt) % t1).str() }</p>
<p>template＜typename T1, T2＞<br />
void BOOST_THROW_EXCEPTION_STRING(const wchar_t *fmt, const T1 &amp;t1, const T2 &amp;t2)<br />
{ throw exception with a string from (boost::format(fmt) % t1 % t2).str() }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: av</title>
		<link>http://blog.hubert.tw/2009/07/08/%e4%b8%80%e5%80%8b-boostexception-%e7%9a%84%e4%be%8b%e5%ad%90/comment-page-1/#comment-54259</link>
		<dc:creator>av</dc:creator>
		<pubDate>Wed, 08 Jul 2009 17:01:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.hubert.tw/?p=535#comment-54259</guid>
		<description>我做過類似的事，不知道是不是你要的方法。我的做法不會用到 va_list，也不需要再定一個 wchar_t wszMessage[BUFSIZ].
我是用 function overload template 來做的，像這樣：
template
void BOOST_THROW_EXCEPTION_STRING(const wchar_t *fmt, const T1 &amp;t1)
{ throw exception with a string from (boost::format(fmt) % t1).str() }

template
void BOOST_THROW_EXCEPTION_STRING(const wchar_t *fmt, const T1 &amp;t1, const T2 &amp;t2)
{ throw exception with a string from (boost::format(fmt) % t1 % t2).str() }

從 0 個參數的版本搞到 20 個參數的版本應該就夠用了。
我在這邊的留言也有提到 http://fsfoundry.org/codefreak/2009/05/04/ostream-type-preservation/</description>
		<content:encoded><![CDATA[<p>我做過類似的事，不知道是不是你要的方法。我的做法不會用到 va_list，也不需要再定一個 wchar_t wszMessage[BUFSIZ].<br />
我是用 function overload template 來做的，像這樣：<br />
template<br />
void BOOST_THROW_EXCEPTION_STRING(const wchar_t *fmt, const T1 &amp;t1)<br />
{ throw exception with a string from (boost::format(fmt) % t1).str() }</p>
<p>template<br />
void BOOST_THROW_EXCEPTION_STRING(const wchar_t *fmt, const T1 &amp;t1, const T2 &amp;t2)<br />
{ throw exception with a string from (boost::format(fmt) % t1 % t2).str() }</p>
<p>從 0 個參數的版本搞到 20 個參數的版本應該就夠用了。<br />
我在這邊的留言也有提到 <a href="http://fsfoundry.org/codefreak/2009/05/04/ostream-type-preservation/" rel="nofollow">http://fsfoundry.org/codefreak/2009/05/04/ostream-type-preservation/</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>

