2011-03-29から1日間の記事一覧

オレオレ switch case つくったよー

C++

つくりはじめてからだいぶ時間が経ってしまったんですが、ぐだぐだになってきたので、暫定版って事で。 #include <iostream> #include <string> #include <boost/lexical_cast.hpp> #include <boost/lambda/lambda.hpp> #include "switch_case.hpp" namespace sc = switch_case; std::string check(int n){ return sc::switch_(n%</boost/lambda/lambda.hpp></boost/lexical_cast.hpp></string></iostream>…

mpl::int_ の比較を行う

mpl::equal で比較を行っていて思いっきりハマってしまいました……。 mpl::equal_to を使用して、比較を行いましょう。 namespace mpl = boost::mpl; BOOST_MPL_ASSERT(( mpl::equal_to<mpl::int_<0>, mpl::int_<0> > )); BOOST_MPL_ASSERT_NOT(( mpl::equal_to<mpl::int_<2>, mpl::int_</mpl::int_<2></mpl::int_<0>…