2007-07-09から1日間の記事一覧

mem_find - メンバ変数検索アルゴリズム(ゲッター版)

C++

非公開メンバ検索用ゲッターを使って検索しますゲッターの形式は、Type getter() const;かType getter();非constなゲッターって需要あるのかわかんないけど、とりあえず作った template <class Iterator, class Target, class Type, class ClassName> inline Iterator mem_find(Iterator first, Iterator last, const Tar</class>…

shared_ptrを使ったSingletonパターン

C++

まだ試してないけど、こんな感じでできるのかな? class singleton { static volatile shared_ptr instance_; singleton() {} public: static shared_ptr get_instance() { if(!instance_) instance_ = new singleton(); return instance_; } void something…