2011-08-19から1日間の記事一覧

Boost.Phoenix で、Boost.Lexical_cast を使う

もうちょっと複雑なコードになるかと思いましたが、function を使えばそんなに難しくありませんでした。 関数の戻り値型をどうするかちょっと悩みましたが、元々関数オブジェクトなので、boost::result_of で取得出来るんですね。 [ソース] #include <boost/phoenix.hpp> #inclu</boost/phoenix.hpp>…

int 型から Boost.MPL の Sequence に変換する

mpl::int_<4241> → mpl::vector_c<int, 4, 2, 4, 1>みたいな感じですね。 [ソース] #include <boost/mpl/vector.hpp> #include <boost/mpl/push_front.hpp> #include <boost/mpl/int.hpp> #include <boost/mpl/divides.hpp> #include <boost/mpl/modulus.hpp> #include <boost/mpl/less_equal.hpp> namespace mpl = boost::mpl; template…</boost/mpl/less_equal.hpp></boost/mpl/modulus.hpp></boost/mpl/divides.hpp></boost/mpl/int.hpp></boost/mpl/push_front.hpp></boost/mpl/vector.hpp></int,>