1 /*============================================================================= 2 Copyright (c) 2006-2007 Tobias Schwinger 3 4 Use modification and distribution are subject to the Boost Software 5 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 6 http://www.boost.org/LICENSE_1_0.txt). 7 ==============================================================================*/ 8 9 #if !defined(BOOST_FUSION_FUNCTIONAL_ADAPTER_FUSED_PROCEDURE_HPP_INCLUDED) 10 #define BOOST_FUSION_FUNCTIONAL_ADAPTER_FUSED_PROCEDURE_HPP_INCLUDED 11 12 #include <boost/fusion/support/config.hpp> 13 #include <boost/type_traits/add_reference.hpp> 14 #include <boost/config.hpp> 15 16 #include <boost/fusion/functional/adapter/detail/access.hpp> 17 #include <boost/fusion/functional/invocation/invoke_procedure.hpp> 18 19 #if defined (BOOST_MSVC) 20 # pragma warning(push) 21 # pragma warning (disable: 4512) // assignment operator could not be generated. 22 #endif 23 24 namespace boost { namespace fusion 25 { 26 template <typename Function> class fused_procedure; 27 28 //----- ---- --- -- - - - - 29 30 template <typename Function> 31 class fused_procedure 32 { 33 Function fnc_transformed; 34 35 typedef typename detail::qf_c<Function>::type & func_const_fwd_t; 36 typedef typename detail::qf<Function>::type & func_fwd_t; 37 38 public: 39 40 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED fused_procedure(func_const_fwd_t f=Function ())41 inline explicit fused_procedure(func_const_fwd_t f = Function()) 42 : fnc_transformed(f) 43 { } 44 45 template <class Seq> 46 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED operator ()(Seq const & s) const47 inline void operator()(Seq const & s) const 48 { 49 fusion::invoke_procedure< 50 func_const_fwd_t >(this->fnc_transformed,s); 51 } 52 53 template <class Seq> 54 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED operator ()(Seq const & s)55 inline void operator()(Seq const & s) 56 { 57 fusion::invoke_procedure< 58 func_fwd_t >(this->fnc_transformed,s); 59 } 60 61 template <class Seq> 62 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED operator ()(Seq & s) const63 inline void operator()(Seq & s) const 64 { 65 fusion::invoke_procedure< 66 func_const_fwd_t >(this->fnc_transformed,s); 67 } 68 69 template <class Seq> 70 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED operator ()(Seq & s)71 inline void operator()(Seq & s) 72 { 73 return fusion::invoke_procedure< 74 func_fwd_t >(this->fnc_transformed,s); 75 } 76 77 typedef void result_type; 78 }; 79 }} 80 81 #if defined (BOOST_MSVC) 82 # pragma warning(pop) 83 #endif 84 85 #endif 86 87