示例#1
0
文件: apply_eval.hpp 项目: eriser/Fit
    constexpr R operator()(const F& f, Ts&&... xs) const
    {
        return
#if FIT_NO_ORDERED_BRACE_INIT
        eval_ordered<R>
            (f, pack(), FIT_FORWARD(Ts)(xs)...);
#else
        eval_helper<R>
            {f, fit::eval(FIT_FORWARD(Ts)(xs))...}.get_result();
#endif
    }
示例#2
0
文件: apply_eval.hpp 项目: eriser/Fit
    constexpr typename detail::holder<Ts...>::type 
    operator()(const F& f, Ts&&... xs) const
    {
        return (typename detail::holder<Ts...>::type)
#if FIT_NO_ORDERED_BRACE_INIT
        eval_ordered<R>
            (f, pack(), FIT_FORWARD(Ts)(xs)...);
#else
        eval_helper<R>
            {f, fit::eval(FIT_FORWARD(Ts)(xs))...};
#endif
    }
示例#3
0
文件: protect.hpp 项目: luffyhwl/Fit
 constexpr protect_adaptor(Ts&&... xs) : detail::callable_base<F>(FIT_FORWARD(Ts)(xs)...)
 {}
示例#4
0
文件: compose.hpp 项目: antmd/Fit
template<class F1, class F2>
struct compose_kernel : detail::compressed_pair<F1, F2>
{
    typedef detail::compressed_pair<F1, F2> base_type;

    FIT_INHERIT_CONSTRUCTOR(compose_kernel, base_type)

    FIT_RETURNS_CLASS(compose_kernel);

    template<class... Ts>
    constexpr FIT_SFINAE_RESULT(const F1&, result_of<const F2&, id_<Ts>...>) 
    operator()(Ts&&... xs) const FIT_SFINAE_RETURNS
    (
        FIT_MANGLE_CAST(const F1&)(FIT_CONST_THIS->first(xs...))(
            FIT_MANGLE_CAST(const F2&)(FIT_CONST_THIS->second(xs...))(FIT_FORWARD(Ts)(xs)...)
        )
    );
};
}

template<class F, class... Fs>
struct compose_adaptor : detail::compose_kernel<detail::callable_base<F>, FIT_JOIN(compose_adaptor, detail::callable_base<Fs>...)>
{
    typedef compose_adaptor fit_rewritable_tag;
    typedef FIT_JOIN(compose_adaptor, detail::callable_base<Fs>...) tail;
    typedef detail::compose_kernel<detail::callable_base<F>, tail> base_type;

    FIT_INHERIT_DEFAULT(compose_adaptor, base_type)

    template<class X, class... Xs, 
示例#5
0
文件: apply_eval.hpp 项目: eriser/Fit
 constexpr eval_helper(const F& f, Ts&&... xs) : result(apply(f, FIT_FORWARD(Ts)(xs)...))
 {}
示例#6
0
文件: apply_eval.hpp 项目: eriser/Fit
constexpr R eval_ordered(const F& f, Pack&& p, T&& x, Ts&&... xs)
{
    return eval_ordered<R>(f, pack_join(FIT_FORWARD(Pack)(p), fit::pack_forward(fit::eval(x))), FIT_FORWARD(Ts)(xs)...);
}
示例#7
0
文件: apply_eval.hpp 项目: eriser/Fit
 constexpr eval_helper(const F& f, Ts&&... xs) : x(apply(f, FIT_FORWARD(Ts)(xs)...), 0)
 {}
示例#8
0
文件: combine.hpp 项目: luffyhwl/Fit
 constexpr combine_adaptor_base(X&& x, Xs&&... xs) 
 : F(FIT_FORWARD(X)(x)), base_type(FIT_FORWARD(Xs)(xs)...)
 {}
示例#9
0
 constexpr compressed_pair(X&& x, Y&& y) 
 : FirstBase(FIT_FORWARD(X)(x)), SecondBase(FIT_FORWARD(Y)(y))
 {}
示例#10
0
 constexpr State operator()(const F&, State&& state) const 
 {
     return FIT_FORWARD(State)(state);
 }
示例#11
0
文件: combine.hpp 项目: luffyhwl/Fit
    template<class... Ts>
    struct combine_result
    : result_of<const F&,  result_of<const Gs&, id_<Ts>>...>
    {};
#endif

    template<class... Ts>
#if FIT_NO_EXPRESSION_SFINAE || FIT_HAS_MANUAL_DEDUCTION
    constexpr typename combine_result<Ts...>::type
#else
    constexpr auto
#endif
    operator()(Ts&&... xs) const FIT_SFINAE_MANUAL_RETURNS
    (
        (FIT_MANGLE_CAST(const F&)(FIT_CONST_THIS->base_function(xs...)))
            (fit::alias_value<pack_tag<seq<Ns>, Gs...>, Gs>(*FIT_CONST_THIS, xs)(FIT_FORWARD(Ts)(xs))...)
    );
};

}

template<class F, class... Gs>
struct combine_adaptor
: detail::combine_adaptor_base<typename detail::gens<sizeof...(Gs)>::type, detail::callable_base<F>, detail::callable_base<Gs>...>
{
    typedef detail::combine_adaptor_base<typename detail::gens<sizeof...(Gs)>::type, detail::callable_base<F>, detail::callable_base<Gs>...> base_type;
    FIT_INHERIT_CONSTRUCTOR(combine_adaptor, base_type)
};

FIT_DECLARE_STATIC_VAR(combine, detail::make<combine_adaptor>);
示例#12
0
#include <fit/detail/delegate.hpp>
#include <fit/detail/compressed_pair.hpp>
#include <fit/detail/move.hpp>
#include <fit/detail/make.hpp>
#include <fit/detail/static_const_var.hpp>

namespace fit { namespace detail {

struct v_reverse_fold
{
    FIT_RETURNS_CLASS(v_reverse_fold);
    template<class F, class State, class T, class... Ts>
    constexpr FIT_SFINAE_MANUAL_RESULT(const F&, result_of<const v_reverse_fold&, id_<const F&>, id_<State>, id_<Ts>...>, id_<T>)
    operator()(const F& f, State&& state, T&& x, Ts&&... xs) const FIT_SFINAE_MANUAL_RETURNS
    (
        f((*FIT_CONST_THIS)(f, FIT_FORWARD(State)(state), FIT_FORWARD(Ts)(xs)...), FIT_FORWARD(T)(x))
    );

    template<class F, class State>
    constexpr State operator()(const F&, State&& state) const 
    {
        return FIT_FORWARD(State)(state);
    }
};

}

template<class F, class State=void>
struct reverse_compress_adaptor
: detail::compressed_pair<detail::callable_base<F>, State>
{
示例#13
0
文件: result.hpp 项目: MORTAL2000/Fit
 constexpr result_type operator()(Ts&&... xs) const
 {
     return this->base_function(xs...)(FIT_FORWARD(Ts)(xs)...);
 };
示例#14
0
 constexpr basic_conditional_adaptor(A&& f1, B&& f2) : F1(FIT_FORWARD(A)(f1)), F2(FIT_FORWARD(B)(f2))
 {}
示例#15
0
 constexpr basic_conditional_adaptor(X&& x) : F1(FIT_FORWARD(X)(x))
 {} 
示例#16
0
    : std::conditional
    <
        is_callable<F1, Ts...>::value, 
        F1,
        F2
    >
    {};

    FIT_RETURNS_CLASS(basic_conditional_adaptor);

    template<class... Ts, class F=typename select<Ts...>::type>
    constexpr FIT_SFINAE_RESULT(typename select<Ts...>::type, id_<Ts>...) 
    operator()(Ts && ... xs) const
    FIT_SFINAE_RETURNS
    (
        FIT_RETURNS_STATIC_CAST(const F&)(*FIT_CONST_THIS)(FIT_FORWARD(Ts)(xs)...)
    );
};

struct low_rank {};

struct high_rank : low_rank {};

template <class ...Ts, class F1, class F2, class = typename std::enable_if<(
    is_callable<F1, Ts...>::value
)>::type>
constexpr F1&& which(high_rank, holder<Ts...>, F1&& f1, F2&&) 
{ 
    return FIT_FORWARD(F1)(f1); 
}