File indexing completed on 2025-01-18 09:30:31
0001
0002
0003
0004
0005
0006
0007 #ifndef BOOST_COROUTINES_DETAIL_SETUP_H
0008 #define BOOST_COROUTINES_DETAIL_SETUP_H
0009
0010 #include <boost/assert.hpp>
0011 #include <boost/config.hpp>
0012 #include <boost/move/move.hpp>
0013 #include <boost/type_traits/decay.hpp>
0014 #include <boost/type_traits/is_convertible.hpp>
0015 #include <boost/type_traits/is_same.hpp>
0016
0017 #include <boost/coroutine/attributes.hpp>
0018 #include <boost/coroutine/detail/coroutine_context.hpp>
0019 #include <boost/coroutine/detail/flags.hpp>
0020
0021 #ifdef BOOST_HAS_ABI_HEADERS
0022 # include BOOST_ABI_PREFIX
0023 #endif
0024
0025 namespace boost {
0026 namespace coroutines {
0027 namespace detail {
0028
0029 template< typename Fn >
0030 struct setup
0031 {
0032 struct dummy {};
0033
0034 Fn fn;
0035 coroutine_context * caller;
0036 coroutine_context * callee;
0037 attributes attr;
0038
0039 #ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
0040 setup( Fn fn_,
0041 coroutine_context * caller_,
0042 coroutine_context * callee_,
0043 attributes const& attr_) :
0044 fn( boost::forward< Fn >( fn_) ),
0045 caller( caller_),
0046 callee( callee_),
0047 attr( attr_)
0048 {}
0049 #endif
0050 setup( BOOST_RV_REF( Fn) fn_,
0051 coroutine_context * caller_,
0052 coroutine_context * callee_,
0053 attributes const& attr_,
0054 typename disable_if<
0055 is_same< typename decay< Fn >::type, setup >,
0056 dummy*
0057 >::type = 0) :
0058 #ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
0059 fn( fn_),
0060 #else
0061 fn( boost::forward< Fn >( fn_) ),
0062 #endif
0063 caller( caller_),
0064 callee( callee_),
0065 attr( attr_)
0066 {}
0067 };
0068
0069 }}}
0070
0071 #ifdef BOOST_HAS_ABI_HEADERS
0072 # include BOOST_ABI_SUFFIX
0073 #endif
0074
0075 #endif