[Update] boost::decay documentation issue
Posted on January 14th, 2010 at 17:35 by fr3@K

The issue with boost::decay documentation that I blogged about 10 days ago has been fixed in trunk.

del.icio.us:[Update] boost::decay documentation issue digg:[Update] boost::decay documentation issue spurl:[Update] boost::decay documentation issue newsvine:[Update] boost::decay documentation issue furl:[Update] boost::decay documentation issue Y!:[Update] boost::decay documentation issue 黑米共享書籤:[Update] boost::decay documentation issue 推推王:[Update] boost::decay documentation issue
boost::decay documentation issue
Posted on January 4th, 2010 at 20:48 by fr3@K

前陣子看了 Hubert 的 一個 boost::exception 的例子, 猛然注意到自己不確定 boost::decay 的作用.

去看了它的 文件, 才發現文件不盡然正確… 已 submit 了一個 ticket 給 Boost, 希望早日修正.

del.icio.us:boost::decay documentation issue digg:boost::decay documentation issue spurl:boost::decay documentation issue newsvine:boost::decay documentation issue furl:boost::decay documentation issue Y!:boost::decay documentation issue 黑米共享書籤:boost::decay documentation issue 推推王:boost::decay documentation issue
Boost.Lexical-Cast Alternatives
Posted on September 17th, 2009 at 21:49 by fr3@K

今天稍早, 跟一位同事聊到 Boost 的 lexical_cast. 打開了 Firefox 請出 Google, 想找到能幫助我介紹 lexical_cast 的資源. 意外地, Google 把我帶到讓我賺了介紹獎金, 現在跟我是同事的 Jeff, 談到 lexical_cast 的 文章.

在這篇文字的討論串, Jeff 寫道:

我覺得如果可以用這樣的寫法,那就太好了:

uint32_t ID = lexical_cast<auto>("1234567");

甚至最好是:

template <class From, class To = auto>
To lexical_cast(From s) {...}

uint32_t ID = lexical_cast("1234567");

Jeff Hung

(more…)

del.icio.us:Boost.Lexical-Cast Alternatives digg:Boost.Lexical-Cast Alternatives spurl:Boost.Lexical-Cast Alternatives newsvine:Boost.Lexical-Cast Alternatives furl:Boost.Lexical-Cast Alternatives Y!:Boost.Lexical-Cast Alternatives 黑米共享書籤:Boost.Lexical-Cast Alternatives 推推王:Boost.Lexical-Cast Alternatives
Observer Pattern, Done Differently
Posted on May 24th, 2009 at 20:43 by fr3@K

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 how C and C++ are different from each other, and how C++ and Java are actually more alike.

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 so Java.

(more…)

del.icio.us:Observer Pattern, Done Differently digg:Observer Pattern, Done Differently spurl:Observer Pattern, Done Differently newsvine:Observer Pattern, Done Differently furl:Observer Pattern, Done Differently Y!:Observer Pattern, Done Differently 黑米共享書籤:Observer Pattern, Done Differently 推推王:Observer Pattern, Done Differently
Output Stream Type Preservation
Posted on May 4th, 2009 at 1:05 by fr3@K

上週看到了一篇引起我興趣的 blog – C++ Format String using boost::format. 冒著再次被人指為 屁的半死 的風險, 身為男子漢的我, 還是決定把心中的 替代解法 寫給了 Hubert 參考. Hubert 建議用 Boost.Format 的解法很好, 可我就是就是忍不住貪玩啊.

緣由交代完了. 有興趣看給 Hubert 參考的解法的朋友請自便, 因為接下來要談的不是它, 而是另一個沒那麼漂亮, 但卻挺有趣的解法.
(more…)

del.icio.us:Output Stream Type Preservation digg:Output Stream Type Preservation spurl:Output Stream Type Preservation newsvine:Output Stream Type Preservation furl:Output Stream Type Preservation Y!:Output Stream Type Preservation 黑米共享書籤:Output Stream Type Preservation 推推王:Output Stream Type Preservation
Contemplation of Prejudice
Posted on April 7th, 2009 at 23:09 by fr3@K

Not long ago, I blogged about how it was difficult to adopt Free libraries in my previous projects at work.

Just today, when I was exploring the compay repository, I see boost sits comfortably under a folder named “3rd_party” in one of my previous projects, along with a couple of tiny Free libraries I wrote.

Apparently, I was wrong and didn’t try hard enough. Going to find the man who made it happen and pay him my respect tomorrow.

del.icio.us:Contemplation of Prejudice digg:Contemplation of Prejudice spurl:Contemplation of Prejudice newsvine:Contemplation of Prejudice furl:Contemplation of Prejudice Y!:Contemplation of Prejudice 黑米共享書籤:Contemplation of Prejudice 推推王:Contemplation of Prejudice
Re: Domain-Specific Language (DSL)
Posted on March 26th, 2009 at 15:09 by fr3@K

Keiko 寫了篇 討論 DSL 的文字. 這篇文字不短, 有層次. 有他說的 “學院派式” 的格調. 讓我有一種在看一份探討輪胎直徑與胎壓以及胎壁厚度之間關係的 paper 的 feel. 相形之下, 這裡寫的東西看起來更像是黑手示範如何補胎換胎的 howto.

好了, 細節不多談, 建議看官移架拜讀. 重點是, 本要在 comment 裏寫 code, 但這該死的 blogger 超難用, 讓我想起當年 從 blogger 離家出走 的原因. 又扯遠了, 回到我想回應給 Keiko 的東西.
(more…)

del.icio.us:Re: Domain-Specific Language (DSL) digg:Re: Domain-Specific Language (DSL) spurl:Re: Domain-Specific Language (DSL) newsvine:Re: Domain-Specific Language (DSL) furl:Re: Domain-Specific Language (DSL) Y!:Re: Domain-Specific Language (DSL) 黑米共享書籤:Re: Domain-Specific Language (DSL) 推推王:Re: Domain-Specific Language (DSL)
Strong Guarantee using Transaction
Posted on April 29th, 2008 at 23:24 by fr3@K

Abrahams Guarantees

在 C++ 的世界裡, 正確的 exception handling 是專業的 C++ programmer 不可或缺的技巧. 雖然它的概念並不困難, 但實作起來卻常不見得那麼容易.

要做到正確的 exception handling, 首先必須要了解什麼是 exception safety. 一個需要與 exception 打交道的 component 可在其介面實作人稱 Abrahams guarantees 的三種 exception safety 保證之一:

  1. The basic guarantee
  2. 允許操作失敗時改變物件的狀態, 但不能有 resource leak. 且該物件的狀態必須是可靠的仍然可以被解構, 操作失敗後該物件的狀態可以是不完全能被預測的.

  3. The strong guarantee
  4. 操作後的狀態只能是成功完成, 或是將該物件回復到操作之前的狀態並拋出一個 exception.

  5. The no-throw guarantee
  6. 操作不會拋出 exception.

(more…)

del.icio.us:Strong Guarantee using Transaction digg:Strong Guarantee using Transaction spurl:Strong Guarantee using Transaction newsvine:Strong Guarantee using Transaction furl:Strong Guarantee using Transaction Y!:Strong Guarantee using Transaction 黑米共享書籤:Strong Guarantee using Transaction 推推王:Strong Guarantee using Transaction
五種寫 For Loop 的方法
Posted on April 11th, 2008 at 6:23 by fr3@K

同樣是寫一個迭代的 loop, 至少有下面兩種標準 (C++98), 兩種半標準 (Boost), 以及一種未來式 (C++0x) 的寫法.
(more…)

del.icio.us:五種寫 For Loop 的方法 digg:五種寫 For Loop 的方法 spurl:五種寫 For Loop 的方法 newsvine:五種寫 For Loop 的方法 furl:五種寫 For Loop 的方法 Y!:五種寫 For Loop 的方法 黑米共享書籤:五種寫 For Loop 的方法 推推王:五種寫 For Loop 的方法
Avoid Pointer Parameters and Inheritance
Posted on May 22nd, 2007 at 23:16 by fr3@K

Preamble

Microsoft 的 MFC 是最早被大量採用 (massive adoption) 的 C++ library 之一. 等到我開始接觸 C++ Standard Library 這東西都已經是玩了兩年 MFC 以後的事. 還記得, 從一開始對 MFC 的讚嘆與擁抱, 幾年後對它的不屑, 到更後來的理解 (理解不好其實也是有原因的).

即便不少 programmer 知道 MFC 是一套瑕疵遍佈的 library, 可能也知道那些地方有問題. 但它以及部份其他 library 聯手對於更多 C++ programmer 造成的傷害已經留下不容易抹滅的痕跡. 它讓許多 programmer 以為這些東西本來就該這樣 (that’s the way things supposed to be), 當有一天這些被誤導的 programmer 有機會可以選擇另一套 library 或是自行設計的時候, 很容易就陷入 MFC 帶給他們已先入為主的錯誤觀念.

(more…)

del.icio.us:Avoid Pointer Parameters and Inheritance digg:Avoid Pointer Parameters and Inheritance spurl:Avoid Pointer Parameters and Inheritance newsvine:Avoid Pointer Parameters and Inheritance furl:Avoid Pointer Parameters and Inheritance Y!:Avoid Pointer Parameters and Inheritance 黑米共享書籤:Avoid Pointer Parameters and Inheritance 推推王:Avoid Pointer Parameters and Inheritance

Page 1 of 2[ 1 ]2»