fused_procedure.hpp 2.5 KB

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