Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:30:24

0001 
0002 //          Copyright Oliver Kowalke 2014.
0003 // Distributed under the Boost Software License, Version 1.0.
0004 //    (See accompanying file LICENSE_1_0.txt or copy at
0005 //          http://www.boost.org/LICENSE_1_0.txt)
0006 
0007 #ifndef BOOST_CONTEXT_DETAIL_INVOKE_H
0008 #define BOOST_CONTEXT_DETAIL_INVOKE_H
0009 
0010 #include <functional>
0011 #include <type_traits>
0012 #include <utility>
0013 
0014 #include <boost/config.hpp>
0015 
0016 #include <boost/context/detail/config.hpp>
0017 
0018 #ifdef BOOST_HAS_ABI_HEADERS
0019 # include BOOST_ABI_PREFIX
0020 #endif
0021 
0022 namespace boost {
0023 namespace context {
0024 namespace detail {
0025 
0026 template< typename Fn, typename ... Args >
0027 typename std::enable_if<
0028     std::is_member_pointer< typename std::decay< Fn >::type >::value,
0029     typename std::result_of< Fn &&( Args && ... ) >::type
0030 >::type
0031 invoke( Fn && fn, Args && ... args) {
0032     return std::mem_fn( fn)( std::forward< Args >( args) ... );   
0033 }
0034 
0035 template< typename Fn, typename ... Args >
0036 typename std::enable_if<
0037     ! std::is_member_pointer< typename std::decay< Fn >::type >::value,
0038     typename std::result_of< Fn &&( Args && ... ) >::type
0039 >::type
0040 invoke( Fn && fn, Args && ... args) {
0041     return std::forward< Fn >( fn)( std::forward< Args >( args) ... );
0042 }
0043 
0044 }}}
0045 
0046 #ifdef BOOST_HAS_ABI_HEADERS
0047 #include BOOST_ABI_SUFFIX
0048 #endif
0049 
0050 #endif // BOOST_CONTEXT_DETAIL_INVOKE_H