lambda.hpp

来自「Boost provides free peer-reviewed portab」· HPP 代码 · 共 1,675 行 · 第 1/5 页

HPP
1,675
字号
        typename proto::result_of::make_expr<            tag::do_while_          , lldomain          , noop_type const &          , Cond const &        >::type const        do_while_loop(Cond const &cond)        {            return proto::implicit_expr(noop, cond);        }        template<typename Cond, typename Body1>        typename proto::result_of::make_expr<            tag::if_          , lldomain          , Cond const &          , Body1 const &        >::type const        if_then(Cond const &cond, Body1 const &body1)        {            return proto::implicit_expr(cond, body1);        }        template<typename Cond, typename Body1, typename Body2>        typename proto::result_of::make_expr<            tag::if_else_          , lldomain          , Cond const &          , Body1 const &          , Body2 const &        >::type const        if_then_else(Cond const &cond, Body1 const &body1, Body2 const &body2)        {            return proto::implicit_expr(cond, body1, body2);        }        template<typename Cond, typename Body1, typename Body2>        typename proto::result_of::make_expr<            proto::tag::if_else_          , lldomain          , Cond const &          , Body1 const &          , Body2 const &        >::type const        if_then_else_return(Cond const &cond, Body1 const &body1, Body2 const &body2)        {            return proto::implicit_expr(cond, body1, body2);        }        template<typename T>        T const &make_const(T const &t)        {            return t;        }        #define M1(Z, N, DATA)                                                                      \        template<BOOST_PP_ENUM_PARAMS_Z(Z, N, typename A)>                                          \        typename proto::result_of::make_expr<                                                       \            proto::tag::function                                                                    \          , lldomain                                                                                \            BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(Z, N, A, const & BOOST_PP_INTERCEPT)             \        >::type const                                                                               \        bind(BOOST_PP_ENUM_BINARY_PARAMS_Z(Z, N, A, const &a))                                      \        {                                                                                           \            return proto::implicit_expr(BOOST_PP_ENUM_PARAMS_Z(Z, N, a));                           \        }                                                                                           \                                                                                                    \        template<typename Ret BOOST_PP_ENUM_TRAILING_PARAMS_Z(Z, N, typename A)>                    \        typename proto::result_of::make_expr<                                                       \            proto::tag::function                                                                    \          , lldomain                                                                                \            BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(Z, N, A, const & BOOST_PP_INTERCEPT)             \        >::type const                                                                               \        bind(BOOST_PP_ENUM_BINARY_PARAMS_Z(Z, N, A, const &a))                                      \        {                                                                                           \            return proto::implicit_expr(BOOST_PP_ENUM_PARAMS_Z(Z, N, a));                           \        }                                                                                           \        /**/        BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(BOOST_PROTO_MAX_ARITY), M1, ~)        #undef M1        template<typename Ret, typename Expr>        Expr const &ret(Expr const &expr)        {            return expr;        }        template<typename Expr>        Expr const &const_parameters(Expr const &expr)        {            return expr;        }        template<typename Expr>        Expr const &break_const(Expr const &expr)        {            return expr;        }        template<typename Lambda>        proto::unexpr<Lambda> const        unlambda(Lambda const &lambda)        {            return proto::unexpr<Lambda>(lambda);        }        template<typename Lambda>        typename proto::result_of::make_expr<            tag::protect          , lldomain          , Lambda const &        >::type const        protect(Lambda const &lambda)        {            return proto::implicit_expr(lambda);        }        template<typename T>        T const std_functor(T const &t)        {            return t;        }        template<typename T>        struct ll_static_cast_fun        {            typedef T result_type;            template<typename U>            T operator()(U &u) const            {                return static_cast<T>(u);            }            template<typename U>            T operator()(U const &u) const            {                return static_cast<T>(u);            }        };        template<typename T, typename U>        typename proto::result_of::make_expr<            proto::tag::function          , lldomain          , ll_static_cast_fun<T>          , U const &        >::type        ll_static_cast(U const &u)        {            ll_static_cast_fun<T> fun;            return proto::implicit_expr(fun, u);        }        template<typename T>        struct ll_const_cast_fun        {            typedef T result_type;            template<typename U>            T operator()(U &u) const            {                return const_cast<T>(u);            }            template<typename U>            T operator()(U const &u) const            {                return const_cast<T>(u);            }        };        template<typename T, typename U>        typename proto::result_of::make_expr<            proto::tag::function          , lldomain          , ll_const_cast_fun<T>          , U const &        >::type        ll_const_cast(U const &u)        {            ll_const_cast_fun<T> fun;            return proto::implicit_expr(fun, u);        }        template<typename T>        struct ll_dynamic_cast_fun        {            typedef T result_type;            template<typename U>            T operator()(U &u) const            {                return dynamic_cast<T>(u);            }            template<typename U>            T operator()(U const &u) const            {                return dynamic_cast<T>(u);            }        };        template<typename T, typename U>        typename proto::result_of::make_expr<            proto::tag::function          , lldomain          , ll_dynamic_cast_fun<T>          , U const &        >::type        ll_dynamic_cast(U const &u)        {            ll_dynamic_cast_fun<T> fun;            return proto::implicit_expr(fun, u);        }        template<typename T>        struct ll_reinterpret_cast_fun        {            typedef T result_type;            template<typename U>            T operator()(U &u) const            {                return reinterpret_cast<T>(u);            }            template<typename U>            T operator()(U const &u) const            {                return reinterpret_cast<T>(u);            }        };        template<typename T, typename U>        typename proto::result_of::make_expr<            proto::tag::function          , lldomain          , ll_reinterpret_cast_fun<T>          , U const &        >::type        ll_reinterpret_cast(U const &u)        {            ll_reinterpret_cast_fun<T> fun;            return proto::implicit_expr(fun, u);        }        struct ll_sizeof_fun        {            typedef std::size_t result_type;            template<typename U>            std::size_t operator()(U const &) const            {                return sizeof(U);            }        };        template<typename U>        typename proto::result_of::make_expr<            proto::tag::function          , lldomain          , ll_sizeof_fun          , U const &        >::type        ll_sizeof(U const &u)        {            ll_sizeof_fun fun;            return proto::implicit_expr(fun, u);        }        struct ll_typeid_fun        {            typedef std::type_info const &result_type;            template<typename U>            std::type_info const &operator()(U const &) const            {                return typeid(U);            }        };        template<typename U>        typename proto::result_of::make_expr<            proto::tag::function          , lldomain          , ll_typeid_fun          , U const &        >::type        ll_typeid(U const &u)        {            ll_typeid_fun fun;            return proto::implicit_expr(fun, u);        }        template<typename T>        struct constructor        {            typedef T result_type;            T operator()() const            {                return T();            }            #define M0(Z, N, DATA)                                                                  \            template<BOOST_PP_ENUM_PARAMS_Z(Z, N, typename A)>                                      \            T operator()(BOOST_PP_ENUM_BINARY_PARAMS_Z(Z, N, A, const &a)) const                    \            {                                                                                       \                return T(BOOST_PP_ENUM_PARAMS_Z(Z, N, a));                                          \            }                                                                                       \            /**/            BOOST_PP_REPEAT_FROM_TO(1, BOOST_PROTO_MAX_ARITY, M0, ~)            #undef M0        };        template<typename T>        struct new_ptr        {            typedef T *result_type;            T *operator()() const            {                return new T();            }            #define M0(Z, N, DATA)                                                                  \            template<BOOST_PP_ENUM_PARAMS_Z(Z, N, typename A)>                                      \            T *operator()(BOOST_PP_ENUM_BINARY_PARAMS_Z(Z, N, A, const &a)) const                   \            {                                                                                       \                return new T(BOOST_PP_ENUM_PARAMS_Z(Z, N, a));                                      \            }                                                                                       \            /**/            BOOST_PP_REPEAT_FROM_TO(1, BOOST_PROTO_MAX_ARITY, M0, ~)            #undef M0

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?