123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762 |
- // Copyright (C) 2012 Vicente J. Botet Escriba
- //
- // Distributed under the Boost Software License, Version 1.0. (See accompanying
- // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- // 2013/04 Vicente J. Botet Escriba
- // Provide implementation up to 9 parameters when BOOST_NO_CXX11_VARIADIC_TEMPLATES is defined.
- // Make use of Boost.Move
- // Make use of Boost.Tuple (movable)
- // 2012/11 Vicente J. Botet Escriba
- // Adapt to boost libc++ implementation
- //===----------------------------------------------------------------------===//
- //
- // The LLVM Compiler Infrastructure
- //
- // This file is dual licensed under the MIT and the University of Illinois Open
- // Source Licenses. See LICENSE.TXT for details.
- //
- // The invoker code is based on the one from libcxx.
- //===----------------------------------------------------------------------===//
- #ifndef BOOST_THREAD_DETAIL_INVOKER_HPP
- #define BOOST_THREAD_DETAIL_INVOKER_HPP
- #include <boost/config.hpp>
- #include <boost/utility/result_of.hpp>
- #include <boost/thread/detail/move.hpp>
- #include <boost/thread/detail/invoke.hpp>
- #include <boost/thread/detail/make_tuple_indices.hpp>
- #include <boost/thread/csbl/tuple.hpp>
- #include <boost/tuple/tuple.hpp>
- #include <boost/thread/detail/variadic_header.hpp>
- namespace boost
- {
- namespace detail
- {
- #if defined(BOOST_THREAD_PROVIDES_INVOKE) && ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && ! defined(BOOST_NO_CXX11_HDR_TUPLE)
- template <class Fp, class ... Args>
- class invoker
- {
- //typedef typename decay<Fp>::type Fpd;
- //typedef tuple<typename decay<Args>::type...> Argsd;
- //csbl::tuple<Fpd, Argsd...> f_;
- csbl::tuple<Fp, Args...> f_;
- public:
- BOOST_THREAD_COPYABLE_AND_MOVABLE( invoker)
- //typedef typename invoke_of<_Fp, _Args...>::type Rp;
- typedef typename result_of<Fp(Args...)>::type result_type;
- template <class F, class ... As>
- BOOST_SYMBOL_VISIBLE
- explicit invoker(BOOST_THREAD_FWD_REF(F) f, BOOST_THREAD_FWD_REF(As)... args)
- : f_(boost::forward<F>(f), boost::forward<As>(args)...)
- {}
- BOOST_SYMBOL_VISIBLE
- invoker(BOOST_THREAD_RV_REF(invoker) f) : f_(boost::move(BOOST_THREAD_RV(f).f_))
- {}
- BOOST_SYMBOL_VISIBLE
- invoker( const invoker& f) : f_(f.f_)
- {}
- BOOST_SYMBOL_VISIBLE
- invoker& operator=(BOOST_THREAD_RV_REF(invoker) f)
- {
- if (this != &f)
- {
- f_ = boost::move(BOOST_THREAD_RV(f).f_);
- }
- return *this;
- }
- BOOST_SYMBOL_VISIBLE
- invoker& operator=( BOOST_THREAD_COPY_ASSIGN_REF(invoker) f)
- {
- if (this != &f)
- {
- f_ = f.f_;
- }
- return *this;
- }
- result_type operator()()
- {
- typedef typename make_tuple_indices<1+sizeof...(Args), 1>::type Index;
- return execute(Index());
- }
- private:
- template <size_t ...Indices>
- result_type
- execute(tuple_indices<Indices...>)
- {
- return detail::invoke(boost::move(csbl::get<0>(f_)), boost::move(csbl::get<Indices>(f_))...);
- }
- };
- template <class R, class Fp, class ... Args>
- class invoker_ret
- {
- //typedef typename decay<Fp>::type Fpd;
- //typedef tuple<typename decay<Args>::type...> Argsd;
- //csbl::tuple<Fpd, Argsd...> f_;
- csbl::tuple<Fp, Args...> f_;
- public:
- BOOST_THREAD_COPYABLE_AND_MOVABLE( invoker_ret)
- typedef R result_type;
- template <class F, class ... As>
- BOOST_SYMBOL_VISIBLE
- explicit invoker_ret(BOOST_THREAD_FWD_REF(F) f, BOOST_THREAD_FWD_REF(As)... args)
- : f_(boost::forward<F>(f), boost::forward<As>(args)...)
- {}
- BOOST_SYMBOL_VISIBLE
- invoker_ret(BOOST_THREAD_RV_REF(invoker_ret) f) : f_(boost::move(BOOST_THREAD_RV(f).f_))
- {}
- result_type operator()()
- {
- typedef typename make_tuple_indices<1+sizeof...(Args), 1>::type Index;
- return execute(Index());
- }
- private:
- template <size_t ...Indices>
- result_type
- execute(tuple_indices<Indices...>)
- {
- return detail::invoke<R>(boost::move(csbl::get<0>(f_)), boost::move(csbl::get<Indices>(f_))...);
- }
- };
- //BOOST_THREAD_DCL_MOVABLE_BEG(X) invoker<Fp> BOOST_THREAD_DCL_MOVABLE_END
- #else
- #if ! defined BOOST_MSVC && defined(BOOST_THREAD_PROVIDES_INVOKE)
- #define BOOST_THREAD_RV_REF_ARG_T(z, n, unused) BOOST_PP_COMMA_IF(n) BOOST_THREAD_RV_REF(Arg##n)
- #define BOOST_THREAD_RV_REF_A_T(z, n, unused) BOOST_PP_COMMA_IF(n) BOOST_THREAD_RV_REF(A##n)
- #define BOOST_THREAD_RV_REF_ARG(z, n, unused) , BOOST_THREAD_RV_REF(Arg##n) arg##n
- #define BOOST_THREAD_FWD_REF_A(z, n, unused) , BOOST_THREAD_FWD_REF(A##n) arg##n
- #define BOOST_THREAD_FWD_REF_ARG(z, n, unused) , BOOST_THREAD_FWD_REF(Arg##n) arg##n
- #define BOOST_THREAD_FWD_PARAM(z, n, unused) , boost::forward<Arg##n>(arg##n)
- #define BOOST_THREAD_FWD_PARAM_A(z, n, unused) , boost::forward<A##n>(arg##n)
- #define BOOST_THREAD_DCL(z, n, unused) Arg##n v##n;
- #define BOOST_THREAD_MOVE_PARAM(z, n, unused) , v##n(boost::move(arg##n))
- #define BOOST_THREAD_FORWARD_PARAM_A(z, n, unused) , v##n(boost::forward<A##n>(arg##n))
- #define BOOST_THREAD_MOVE_RHS_PARAM(z, n, unused) , v##n(boost::move(x.v##n))
- #define BOOST_THREAD_MOVE_DCL(z, n, unused) , boost::move(v##n)
- #define BOOST_THREAD_MOVE_DCL_T(z, n, unused) BOOST_PP_COMMA_IF(n) boost::move(v##n)
- #define BOOST_THREAD_ARG_DEF(z, n, unused) , class Arg##n = tuples::null_type
- template <class Fp, class Arg = tuples::null_type
- BOOST_PP_REPEAT(BOOST_THREAD_MAX_ARGS, BOOST_THREAD_ARG_DEF, ~)
- >
- class invoker;
- #define BOOST_THREAD_ASYNC_FUNCT(z, n, unused) \
- template <class Fp BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, class Arg) > \
- class invoker<Fp BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, Arg)> \
- { \
- Fp fp_; \
- BOOST_PP_REPEAT(n, BOOST_THREAD_DCL, ~) \
- public: \
- BOOST_THREAD_COPYABLE_AND_MOVABLE(invoker) \
- typedef typename result_of<Fp(BOOST_PP_ENUM_PARAMS(n, Arg))>::type result_type; \
- \
- template <class F BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, class A) > \
- BOOST_SYMBOL_VISIBLE \
- explicit invoker(BOOST_THREAD_FWD_REF(F) f \
- BOOST_PP_REPEAT(n, BOOST_THREAD_FWD_REF_A, ~) \
- ) \
- : fp_(boost::forward<F>(f)) \
- BOOST_PP_REPEAT(n, BOOST_THREAD_FORWARD_PARAM_A, ~) \
- {} \
- \
- BOOST_SYMBOL_VISIBLE \
- invoker(BOOST_THREAD_RV_REF(invoker) x) \
- : fp_(boost::move(x.fp_)) \
- BOOST_PP_REPEAT(n, BOOST_THREAD_MOVE_RHS_PARAM, ~) \
- {} \
- \
- result_type operator()() { \
- return detail::invoke(boost::move(fp_) \
- BOOST_PP_REPEAT(n, BOOST_THREAD_MOVE_DCL, ~) \
- ); \
- } \
- }; \
- \
- template <class R BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, class Arg) > \
- class invoker<R(*)(BOOST_PP_REPEAT(n, BOOST_THREAD_RV_REF_ARG_T, ~)) BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, Arg)> \
- { \
- typedef R(*Fp)(BOOST_PP_REPEAT(n, BOOST_THREAD_RV_REF_ARG_T, ~)); \
- Fp fp_; \
- BOOST_PP_REPEAT(n, BOOST_THREAD_DCL, ~) \
- public: \
- BOOST_THREAD_COPYABLE_AND_MOVABLE(invoker) \
- typedef typename result_of<Fp(BOOST_PP_ENUM_PARAMS(n, Arg))>::type result_type; \
- \
- template <class R2 BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, class A) > \
- BOOST_SYMBOL_VISIBLE \
- explicit invoker(R2(*f)(BOOST_PP_REPEAT(n, BOOST_THREAD_RV_REF_A_T, ~)) \
- BOOST_PP_REPEAT(n, BOOST_THREAD_FWD_REF_A, ~) \
- ) \
- : fp_(f) \
- BOOST_PP_REPEAT(n, BOOST_THREAD_FORWARD_PARAM_A, ~) \
- {} \
- \
- BOOST_SYMBOL_VISIBLE \
- invoker(BOOST_THREAD_RV_REF(invoker) x) \
- : fp_(x.fp_) \
- BOOST_PP_REPEAT(n, BOOST_THREAD_MOVE_RHS_PARAM, ~) \
- {} \
- \
- result_type operator()() { \
- return fp_( \
- BOOST_PP_REPEAT(n, BOOST_THREAD_MOVE_DCL_T, ~) \
- ); \
- } \
- };
- BOOST_PP_REPEAT(BOOST_THREAD_MAX_ARGS, BOOST_THREAD_ASYNC_FUNCT, ~)
- #undef BOOST_THREAD_RV_REF_ARG_T
- #undef BOOST_THREAD_RV_REF_ARG
- #undef BOOST_THREAD_FWD_REF_ARG
- #undef BOOST_THREAD_FWD_REF_A
- #undef BOOST_THREAD_FWD_PARAM
- #undef BOOST_THREAD_FWD_PARAM_A
- #undef BOOST_THREAD_DCL
- #undef BOOST_THREAD_MOVE_PARAM
- #undef BOOST_THREAD_MOVE_RHS_PARAM
- #undef BOOST_THREAD_MOVE_DCL
- #undef BOOST_THREAD_ARG_DEF
- #undef BOOST_THREAD_ASYNC_FUNCT
- #else
- template <class Fp,
- class T0 = tuples::null_type, class T1 = tuples::null_type, class T2 = tuples::null_type,
- class T3 = tuples::null_type, class T4 = tuples::null_type, class T5 = tuples::null_type,
- class T6 = tuples::null_type, class T7 = tuples::null_type, class T8 = tuples::null_type
- , class T9 = tuples::null_type
- >
- class invoker;
- template <class Fp,
- class T0 , class T1 , class T2 ,
- class T3 , class T4 , class T5 ,
- class T6 , class T7 , class T8 >
- class invoker<Fp, T0, T1, T2, T3, T4, T5, T6, T7, T8>
- {
- Fp fp_;
- T0 v0_;
- T1 v1_;
- T2 v2_;
- T3 v3_;
- T4 v4_;
- T5 v5_;
- T6 v6_;
- T7 v7_;
- T8 v8_;
- //::boost::tuple<Fp, T0, T1, T2, T3, T4, T5, T6, T7, T8> f_;
- public:
- BOOST_THREAD_COPYABLE_AND_MOVABLE(invoker)
- typedef typename result_of<Fp(T0, T1, T2, T3, T4, T5, T6, T7, T8)>::type result_type;
- BOOST_SYMBOL_VISIBLE
- explicit invoker(BOOST_THREAD_FWD_REF(Fp) f
- , BOOST_THREAD_RV_REF(T0) a0
- , BOOST_THREAD_RV_REF(T1) a1
- , BOOST_THREAD_RV_REF(T2) a2
- , BOOST_THREAD_RV_REF(T3) a3
- , BOOST_THREAD_RV_REF(T4) a4
- , BOOST_THREAD_RV_REF(T5) a5
- , BOOST_THREAD_RV_REF(T6) a6
- , BOOST_THREAD_RV_REF(T7) a7
- , BOOST_THREAD_RV_REF(T8) a8
- )
- : fp_(boost::move(f))
- , v0_(boost::move(a0))
- , v1_(boost::move(a1))
- , v2_(boost::move(a2))
- , v3_(boost::move(a3))
- , v4_(boost::move(a4))
- , v5_(boost::move(a5))
- , v6_(boost::move(a6))
- , v7_(boost::move(a7))
- , v8_(boost::move(a8))
- {}
- BOOST_SYMBOL_VISIBLE
- invoker(BOOST_THREAD_RV_REF(invoker) f)
- : fp_(boost::move(BOOST_THREAD_RV(f).fp))
- , v0_(boost::move(BOOST_THREAD_RV(f).v0_))
- , v1_(boost::move(BOOST_THREAD_RV(f).v1_))
- , v2_(boost::move(BOOST_THREAD_RV(f).v2_))
- , v3_(boost::move(BOOST_THREAD_RV(f).v3_))
- , v4_(boost::move(BOOST_THREAD_RV(f).v4_))
- , v5_(boost::move(BOOST_THREAD_RV(f).v5_))
- , v6_(boost::move(BOOST_THREAD_RV(f).v6_))
- , v7_(boost::move(BOOST_THREAD_RV(f).v7_))
- , v8_(boost::move(BOOST_THREAD_RV(f).v8_))
- {}
- result_type operator()()
- {
- return detail::invoke(boost::move(fp_)
- , boost::move(v0_)
- , boost::move(v1_)
- , boost::move(v2_)
- , boost::move(v3_)
- , boost::move(v4_)
- , boost::move(v5_)
- , boost::move(v6_)
- , boost::move(v7_)
- , boost::move(v8_)
- );
- }
- };
- template <class Fp, class T0, class T1, class T2, class T3, class T4, class T5, class T6, class T7 >
- class invoker<Fp, T0, T1, T2, T3, T4, T5, T6, T7>
- {
- Fp fp_;
- T0 v0_;
- T1 v1_;
- T2 v2_;
- T3 v3_;
- T4 v4_;
- T5 v5_;
- T6 v6_;
- T7 v7_;
- public:
- BOOST_THREAD_COPYABLE_AND_MOVABLE(invoker)
- typedef typename result_of<Fp(T0, T1, T2, T3, T4, T5, T6, T7)>::type result_type;
- BOOST_SYMBOL_VISIBLE
- explicit invoker(BOOST_THREAD_FWD_REF(Fp) f
- , BOOST_THREAD_RV_REF(T0) a0
- , BOOST_THREAD_RV_REF(T1) a1
- , BOOST_THREAD_RV_REF(T2) a2
- , BOOST_THREAD_RV_REF(T3) a3
- , BOOST_THREAD_RV_REF(T4) a4
- , BOOST_THREAD_RV_REF(T5) a5
- , BOOST_THREAD_RV_REF(T6) a6
- , BOOST_THREAD_RV_REF(T7) a7
- )
- : fp_(boost::move(f))
- , v0_(boost::move(a0))
- , v1_(boost::move(a1))
- , v2_(boost::move(a2))
- , v3_(boost::move(a3))
- , v4_(boost::move(a4))
- , v5_(boost::move(a5))
- , v6_(boost::move(a6))
- , v7_(boost::move(a7))
- {}
- BOOST_SYMBOL_VISIBLE
- invoker(BOOST_THREAD_RV_REF(invoker) f)
- : fp_(boost::move(BOOST_THREAD_RV(f).fp))
- , v0_(boost::move(BOOST_THREAD_RV(f).v0_))
- , v1_(boost::move(BOOST_THREAD_RV(f).v1_))
- , v2_(boost::move(BOOST_THREAD_RV(f).v2_))
- , v3_(boost::move(BOOST_THREAD_RV(f).v3_))
- , v4_(boost::move(BOOST_THREAD_RV(f).v4_))
- , v5_(boost::move(BOOST_THREAD_RV(f).v5_))
- , v6_(boost::move(BOOST_THREAD_RV(f).v6_))
- , v7_(boost::move(BOOST_THREAD_RV(f).v7_))
- {}
- result_type operator()()
- {
- return detail::invoke(boost::move(fp_)
- , boost::move(v0_)
- , boost::move(v1_)
- , boost::move(v2_)
- , boost::move(v3_)
- , boost::move(v4_)
- , boost::move(v5_)
- , boost::move(v6_)
- , boost::move(v7_)
- );
- }
- };
- template <class Fp, class T0, class T1, class T2, class T3, class T4, class T5, class T6>
- class invoker<Fp, T0, T1, T2, T3, T4, T5, T6>
- {
- Fp fp_;
- T0 v0_;
- T1 v1_;
- T2 v2_;
- T3 v3_;
- T4 v4_;
- T5 v5_;
- T6 v6_;
- public:
- BOOST_THREAD_COPYABLE_AND_MOVABLE(invoker)
- typedef typename result_of<Fp(T0, T1, T2, T3, T4, T5, T6)>::type result_type;
- BOOST_SYMBOL_VISIBLE
- explicit invoker(BOOST_THREAD_FWD_REF(Fp) f
- , BOOST_THREAD_RV_REF(T0) a0
- , BOOST_THREAD_RV_REF(T1) a1
- , BOOST_THREAD_RV_REF(T2) a2
- , BOOST_THREAD_RV_REF(T3) a3
- , BOOST_THREAD_RV_REF(T4) a4
- , BOOST_THREAD_RV_REF(T5) a5
- , BOOST_THREAD_RV_REF(T6) a6
- )
- : fp_(boost::move(f))
- , v0_(boost::move(a0))
- , v1_(boost::move(a1))
- , v2_(boost::move(a2))
- , v3_(boost::move(a3))
- , v4_(boost::move(a4))
- , v5_(boost::move(a5))
- , v6_(boost::move(a6))
- {}
- BOOST_SYMBOL_VISIBLE
- invoker(BOOST_THREAD_RV_REF(invoker) f)
- : fp_(boost::move(BOOST_THREAD_RV(f).fp))
- , v0_(boost::move(BOOST_THREAD_RV(f).v0_))
- , v1_(boost::move(BOOST_THREAD_RV(f).v1_))
- , v2_(boost::move(BOOST_THREAD_RV(f).v2_))
- , v3_(boost::move(BOOST_THREAD_RV(f).v3_))
- , v4_(boost::move(BOOST_THREAD_RV(f).v4_))
- , v5_(boost::move(BOOST_THREAD_RV(f).v5_))
- , v6_(boost::move(BOOST_THREAD_RV(f).v6_))
- {}
- result_type operator()()
- {
- return detail::invoke(boost::move(fp_)
- , boost::move(v0_)
- , boost::move(v1_)
- , boost::move(v2_)
- , boost::move(v3_)
- , boost::move(v4_)
- , boost::move(v5_)
- , boost::move(v6_)
- );
- }
- };
- template <class Fp, class T0, class T1, class T2, class T3, class T4, class T5>
- class invoker<Fp, T0, T1, T2, T3, T4, T5>
- {
- Fp fp_;
- T0 v0_;
- T1 v1_;
- T2 v2_;
- T3 v3_;
- T4 v4_;
- T5 v5_;
- public:
- BOOST_THREAD_COPYABLE_AND_MOVABLE(invoker)
- typedef typename result_of<Fp(T0, T1, T2, T3, T4, T5)>::type result_type;
- BOOST_SYMBOL_VISIBLE
- explicit invoker(BOOST_THREAD_FWD_REF(Fp) f
- , BOOST_THREAD_RV_REF(T0) a0
- , BOOST_THREAD_RV_REF(T1) a1
- , BOOST_THREAD_RV_REF(T2) a2
- , BOOST_THREAD_RV_REF(T3) a3
- , BOOST_THREAD_RV_REF(T4) a4
- , BOOST_THREAD_RV_REF(T5) a5
- )
- : fp_(boost::move(f))
- , v0_(boost::move(a0))
- , v1_(boost::move(a1))
- , v2_(boost::move(a2))
- , v3_(boost::move(a3))
- , v4_(boost::move(a4))
- , v5_(boost::move(a5))
- {}
- BOOST_SYMBOL_VISIBLE
- invoker(BOOST_THREAD_RV_REF(invoker) f)
- : fp_(boost::move(BOOST_THREAD_RV(f).fp))
- , v0_(boost::move(BOOST_THREAD_RV(f).v0_))
- , v1_(boost::move(BOOST_THREAD_RV(f).v1_))
- , v2_(boost::move(BOOST_THREAD_RV(f).v2_))
- , v3_(boost::move(BOOST_THREAD_RV(f).v3_))
- , v4_(boost::move(BOOST_THREAD_RV(f).v4_))
- , v5_(boost::move(BOOST_THREAD_RV(f).v5_))
- {}
- result_type operator()()
- {
- return detail::invoke(boost::move(fp_)
- , boost::move(v0_)
- , boost::move(v1_)
- , boost::move(v2_)
- , boost::move(v3_)
- , boost::move(v4_)
- , boost::move(v5_)
- );
- }
- };
- template <class Fp, class T0, class T1, class T2, class T3, class T4>
- class invoker<Fp, T0, T1, T2, T3, T4>
- {
- Fp fp_;
- T0 v0_;
- T1 v1_;
- T2 v2_;
- T3 v3_;
- T4 v4_;
- public:
- BOOST_THREAD_COPYABLE_AND_MOVABLE(invoker)
- typedef typename result_of<Fp(T0, T1, T2, T3, T4)>::type result_type;
- BOOST_SYMBOL_VISIBLE
- explicit invoker(BOOST_THREAD_FWD_REF(Fp) f
- , BOOST_THREAD_RV_REF(T0) a0
- , BOOST_THREAD_RV_REF(T1) a1
- , BOOST_THREAD_RV_REF(T2) a2
- , BOOST_THREAD_RV_REF(T3) a3
- , BOOST_THREAD_RV_REF(T4) a4
- )
- : fp_(boost::move(f))
- , v0_(boost::move(a0))
- , v1_(boost::move(a1))
- , v2_(boost::move(a2))
- , v3_(boost::move(a3))
- , v4_(boost::move(a4))
- {}
- BOOST_SYMBOL_VISIBLE
- invoker(BOOST_THREAD_RV_REF(invoker) f)
- : fp_(boost::move(BOOST_THREAD_RV(f).fp))
- , v0_(boost::move(BOOST_THREAD_RV(f).v0_))
- , v1_(boost::move(BOOST_THREAD_RV(f).v1_))
- , v2_(boost::move(BOOST_THREAD_RV(f).v2_))
- , v3_(boost::move(BOOST_THREAD_RV(f).v3_))
- , v4_(boost::move(BOOST_THREAD_RV(f).v4_))
- {}
- result_type operator()()
- {
- return detail::invoke(boost::move(fp_)
- , boost::move(v0_)
- , boost::move(v1_)
- , boost::move(v2_)
- , boost::move(v3_)
- , boost::move(v4_)
- );
- }
- };
- template <class Fp, class T0, class T1, class T2, class T3>
- class invoker<Fp, T0, T1, T2, T3>
- {
- Fp fp_;
- T0 v0_;
- T1 v1_;
- T2 v2_;
- T3 v3_;
- public:
- BOOST_THREAD_COPYABLE_AND_MOVABLE(invoker)
- typedef typename result_of<Fp(T0, T1, T2, T3)>::type result_type;
- BOOST_SYMBOL_VISIBLE
- explicit invoker(BOOST_THREAD_FWD_REF(Fp) f
- , BOOST_THREAD_RV_REF(T0) a0
- , BOOST_THREAD_RV_REF(T1) a1
- , BOOST_THREAD_RV_REF(T2) a2
- , BOOST_THREAD_RV_REF(T3) a3
- )
- : fp_(boost::move(f))
- , v0_(boost::move(a0))
- , v1_(boost::move(a1))
- , v2_(boost::move(a2))
- , v3_(boost::move(a3))
- {}
- BOOST_SYMBOL_VISIBLE
- invoker(BOOST_THREAD_RV_REF(invoker) f)
- : fp_(boost::move(BOOST_THREAD_RV(f).fp))
- , v0_(boost::move(BOOST_THREAD_RV(f).v0_))
- , v1_(boost::move(BOOST_THREAD_RV(f).v1_))
- , v2_(boost::move(BOOST_THREAD_RV(f).v2_))
- , v3_(boost::move(BOOST_THREAD_RV(f).v3_))
- {}
- result_type operator()()
- {
- return detail::invoke(boost::move(fp_)
- , boost::move(v0_)
- , boost::move(v1_)
- , boost::move(v2_)
- , boost::move(v3_)
- );
- }
- };
- template <class Fp, class T0, class T1, class T2>
- class invoker<Fp, T0, T1, T2>
- {
- Fp fp_;
- T0 v0_;
- T1 v1_;
- T2 v2_;
- public:
- BOOST_THREAD_COPYABLE_AND_MOVABLE(invoker)
- typedef typename result_of<Fp(T0, T1, T2)>::type result_type;
- BOOST_SYMBOL_VISIBLE
- explicit invoker(BOOST_THREAD_FWD_REF(Fp) f
- , BOOST_THREAD_RV_REF(T0) a0
- , BOOST_THREAD_RV_REF(T1) a1
- , BOOST_THREAD_RV_REF(T2) a2
- )
- : fp_(boost::move(f))
- , v0_(boost::move(a0))
- , v1_(boost::move(a1))
- , v2_(boost::move(a2))
- {}
- BOOST_SYMBOL_VISIBLE
- invoker(BOOST_THREAD_RV_REF(invoker) f)
- : fp_(boost::move(BOOST_THREAD_RV(f).fp))
- , v0_(boost::move(BOOST_THREAD_RV(f).v0_))
- , v1_(boost::move(BOOST_THREAD_RV(f).v1_))
- , v2_(boost::move(BOOST_THREAD_RV(f).v2_))
- {}
- result_type operator()()
- {
- return detail::invoke(boost::move(fp_)
- , boost::move(v0_)
- , boost::move(v1_)
- , boost::move(v2_)
- );
- }
- };
- template <class Fp, class T0, class T1>
- class invoker<Fp, T0, T1>
- {
- Fp fp_;
- T0 v0_;
- T1 v1_;
- public:
- BOOST_THREAD_COPYABLE_AND_MOVABLE(invoker)
- typedef typename result_of<Fp(T0, T1)>::type result_type;
- BOOST_SYMBOL_VISIBLE
- explicit invoker(BOOST_THREAD_FWD_REF(Fp) f
- , BOOST_THREAD_RV_REF(T0) a0
- , BOOST_THREAD_RV_REF(T1) a1
- )
- : fp_(boost::move(f))
- , v0_(boost::move(a0))
- , v1_(boost::move(a1))
- {}
- BOOST_SYMBOL_VISIBLE
- invoker(BOOST_THREAD_RV_REF(invoker) f)
- : fp_(boost::move(BOOST_THREAD_RV(f).fp))
- , v0_(boost::move(BOOST_THREAD_RV(f).v0_))
- , v1_(boost::move(BOOST_THREAD_RV(f).v1_))
- {}
- result_type operator()()
- {
- return detail::invoke(boost::move(fp_)
- , boost::move(v0_)
- , boost::move(v1_)
- );
- }
- };
- template <class Fp, class T0>
- class invoker<Fp, T0>
- {
- Fp fp_;
- T0 v0_;
- public:
- BOOST_THREAD_COPYABLE_AND_MOVABLE(invoker)
- typedef typename result_of<Fp(T0)>::type result_type;
- BOOST_SYMBOL_VISIBLE
- explicit invoker(BOOST_THREAD_FWD_REF(Fp) f
- , BOOST_THREAD_RV_REF(T0) a0
- )
- : fp_(boost::move(f))
- , v0_(boost::move(a0))
- {}
- BOOST_SYMBOL_VISIBLE
- invoker(BOOST_THREAD_RV_REF(invoker) f)
- : fp_(boost::move(BOOST_THREAD_RV(f).fp))
- , v0_(boost::move(BOOST_THREAD_RV(f).v0_))
- {}
- result_type operator()()
- {
- return detail::invoke(boost::move(fp_)
- , boost::move(v0_)
- );
- }
- };
- template <class Fp>
- class invoker<Fp>
- {
- Fp fp_;
- public:
- BOOST_THREAD_COPYABLE_AND_MOVABLE(invoker)
- typedef typename result_of<Fp()>::type result_type;
- BOOST_SYMBOL_VISIBLE
- explicit invoker(BOOST_THREAD_FWD_REF(Fp) f)
- : fp_(boost::move(f))
- {}
- BOOST_SYMBOL_VISIBLE
- invoker(BOOST_THREAD_RV_REF(invoker) f)
- : fp_(boost::move(f.fp_))
- {}
- result_type operator()()
- {
- return fp_();
- }
- };
- template <class R>
- class invoker<R(*)()>
- {
- typedef R(*Fp)();
- Fp fp_;
- public:
- BOOST_THREAD_COPYABLE_AND_MOVABLE(invoker)
- typedef typename result_of<Fp()>::type result_type;
- BOOST_SYMBOL_VISIBLE
- explicit invoker(Fp f)
- : fp_(f)
- {}
- BOOST_SYMBOL_VISIBLE
- invoker(BOOST_THREAD_RV_REF(invoker) f)
- : fp_(f.fp_)
- {}
- result_type operator()()
- {
- return fp_();
- }
- };
- #endif
- #endif
- }
- }
- #include <boost/thread/detail/variadic_footer.hpp>
- #endif // header
|