2009-07-02から1日間の記事一覧

テンプレートメタプログラミングでMaybeモナド

C++

「階層化された型リスト」で、連続したメタ関数の適用が書きやすくなったので Maybeモナドもいけるかな、と思って作ってみました。 #include <iostream> #include <boost/type_traits.hpp> #include <boost/mpl/if.hpp> template <class T> struct just; struct nothing; template <class T> struct return_ { typedef just<T> type; }</t></class></class></boost/mpl/if.hpp></boost/type_traits.hpp></iostream>…