2007-09-18から1日間の記事一覧

Boostを作ってるわけですが

ホントにほしいのはbindとlambdaとBOOST_FOREACHなんだ

mpl::if_

C++

コンパイル時if文mpl::if_::type namespace shand { namespace mpl { // if_c template <bool Cond, class Then, class Else> struct if_c; template <class Then, class Else> struct if_c<true, Then, Else> { typedef Then type; }; template <class Then, class Else> struct if_c<false, Then, Else> { typedef Else type; };…</false,></class></true,></class></bool>

mpl::eval_if

C++

mpl::if_と違い mpl::eval_if のThenとElseはtype型を持ったクラス namespace shand { namespace mpl { // eval_if_c template <bool Cond, class Then, class Else> struct eval_if_c; template <class Then, class Else> struct eval_if_c<true, Then, Else> { typedef typename Then::type type; }; template <class Then, class Else>…</class></true,></class></bool>

mpl::identity

C++

identity::typeがTypeを返すだけのものeval_ifとかに使う namespace shand { namespace mpl { template <class Type> struct identity { typedef Type type; }; }} // namespace shand::mpl #include <iostream> #include <shand/type_traits.hpp> #include <shand/mpl/eval_if.hpp> #include <shand/mpl/identity.hpp> using namespace s…</shand/mpl/identity.hpp></shand/mpl/eval_if.hpp></shand/type_traits.hpp></iostream></class>