2007-02-15 22:41:45 +00:00
|
|
|
/*=============================================================================
|
|
|
|
Copyright (c) 2006-2007 Tobias Schwinger
|
|
|
|
|
|
|
|
Use modification and distribution are subject to 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).
|
|
|
|
==============================================================================*/
|
|
|
|
|
|
|
|
#if !defined(BOOST_FUSION_FUNCTIONAL_ADAPTER_FUSED_PROCEDURE_HPP_INCLUDED)
|
|
|
|
#define BOOST_FUSION_FUNCTIONAL_ADAPTER_FUSED_PROCEDURE_HPP_INCLUDED
|
|
|
|
|
|
|
|
#include <boost/type_traits/add_reference.hpp>
|
|
|
|
|
|
|
|
#include <boost/fusion/support/detail/access.hpp>
|
|
|
|
#include <boost/fusion/functional/invocation/invoke_procedure.hpp>
|
|
|
|
|
|
|
|
namespace boost { namespace fusion
|
|
|
|
{
|
|
|
|
template <typename Function> class fused_procedure;
|
|
|
|
|
|
|
|
//----- ---- --- -- - - - -
|
|
|
|
|
|
|
|
template <typename Function>
|
|
|
|
class fused_procedure
|
|
|
|
{
|
|
|
|
Function fnc_transformed;
|
|
|
|
|
|
|
|
typedef typename boost::add_reference<Function>::type func_fwd_t;
|
|
|
|
typedef typename detail::call_param<Function>::type func_const_fwd_t;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
inline explicit fused_procedure(func_const_fwd_t f = Function())
|
|
|
|
: fnc_transformed(f)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
template <class Seq>
|
2007-07-12 09:08:46 +00:00
|
|
|
inline void operator()(Seq const & s) const
|
2007-02-15 22:41:45 +00:00
|
|
|
{
|
2007-07-12 09:08:46 +00:00
|
|
|
fusion::invoke_procedure<
|
|
|
|
func_const_fwd_t >(this->fnc_transformed,s);
|
2007-02-15 22:41:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Seq>
|
2007-07-12 09:08:46 +00:00
|
|
|
inline void operator()(Seq const & s)
|
2007-02-15 22:41:45 +00:00
|
|
|
{
|
2007-07-12 09:08:46 +00:00
|
|
|
fusion::invoke_procedure<
|
|
|
|
func_fwd_t >(this->fnc_transformed,s);
|
2007-02-15 22:41:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Seq>
|
2007-07-12 09:08:46 +00:00
|
|
|
inline void operator()(Seq & s) const
|
2007-02-15 22:41:45 +00:00
|
|
|
{
|
2007-07-12 09:08:46 +00:00
|
|
|
fusion::invoke_procedure<
|
|
|
|
func_const_fwd_t >(this->fnc_transformed,s);
|
2007-02-15 22:41:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Seq>
|
2007-07-12 09:08:46 +00:00
|
|
|
inline void operator()(Seq & s)
|
2007-02-15 22:41:45 +00:00
|
|
|
{
|
2007-07-12 09:08:46 +00:00
|
|
|
return fusion::invoke_procedure<
|
|
|
|
func_fwd_t >(this->fnc_transformed,s);
|
2007-02-15 22:41:45 +00:00
|
|
|
}
|
|
|
|
|
2007-07-13 18:47:02 +00:00
|
|
|
typedef void result_type;
|
2007-02-15 22:41:45 +00:00
|
|
|
};
|
|
|
|
}}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|