2007-05-14から1日間の記事一覧

いま流行のFizzBuzzを純粋関数型言語C++で書いてみた

c++

73行。boost/mplやboost/lambda駆使すれば20行くらいになるかな? なんかあんまり純粋関数な感じしないんだよね微妙。 template<bool cond,typename th,typename el> struct if_; template<typename th,typename el> struct if_<true,th,el> { typedef th result; }; template<typename th,typename el> struct if_<false,th,el> { typedef el result; }; template</false,th,el></typename></true,th,el></typename></bool>