2009-12-13から1日間の記事一覧

Boost.Function について

Boost の万能ファンクタ Boost.Function は、そのコピーの際、中に格納された関数オブジェクトも一緒にコピーしてくれます: #include <boost/function.hpp> #include <iostream> #include <boost/format.hpp> // 萌え using namespace std; using boost::format; // テスト用ファンクタ struct counter { exp</boost/format.hpp></iostream></boost/function.hpp>…

gintenlib.cast を使う

これは、使用例を見れば一目瞭然でしょう: #include <gintenlib/cast.hpp> #include <iostream> using namespace std; // 適当に多重定義関数を用意します void hoge( int ) { cout << "int version\n"; } void hoge( void* ){ cout << "void* version\n"; } // 同様にクラスに対しても関</iostream></gintenlib/cast.hpp>…