2010-11-25から1日間の記事一覧

コンストラクタの部分評価

C++

Boost 1.43.0から入ったFunctional/Factoryは、ユーザーコードではどういったときに使うのかと思っていたら、bindと組み合わせてコンストラクタの部分評価に使えそうです。 こんな感じ。 #include <boost/functional/value_factory.hpp> #include <boost/bind.hpp> #include <boost/function.hpp> #include <boost/assert.hpp> struct Point { int x, y; </boost/assert.hpp></boost/function.hpp></boost/bind.hpp></boost/functional/value_factory.hpp>…