/*============================================================================== Copyright (c) 2005-2010 Joel de Guzman Copyright (c) 2011 Thomas Heller Distributed under 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) ==============================================================================*/ #ifndef BOOST_PHOENIX_CORE_CALL_HPP #define BOOST_PHOENIX_CORE_CALL_HPP #include #include #include #include #include #ifndef BOOST_PHOENIX_NO_VARIADIC_CALL # include #endif namespace boost { namespace phoenix { namespace detail { template < typename Fun , typename Expr , typename State , typename Data , long Arity = proto::arity_of::value > struct call_impl; template struct call_impl : proto::transform_impl { typedef typename boost::phoenix::result_of::context::type context_type; typedef typename boost::result_of< Fun(Expr, context_type) >::type result_type; result_type operator()( typename call_impl::expr_param e , typename call_impl::state_param s , typename call_impl::data_param d ) const { return Fun()(e, boost::phoenix::context(s, d)); } }; #ifdef BOOST_PHOENIX_NO_VARIADIC_CALL #include #else template struct call_impl_; template struct call_impl_ > : proto::transform_impl { typedef typename boost::phoenix::result_of::context::type context_type; template struct result_of_expr { typedef typename proto::result_of::child_c::type type; }; typedef typename boost::result_of< Fun( typename result_of_expr::type... , context_type ) >::type result_type; result_type operator()( typename call_impl_::expr_param e , typename call_impl_::state_param s , typename call_impl_::data_param d ) const { return Fun()( proto::child_c(e)... , boost::phoenix::context(s, d) ); } }; template struct call_impl : call_impl_::type> { }; #endif } template struct call : proto::transform > { template struct impl : detail::call_impl {}; }; } namespace proto { template struct is_callable > : mpl::true_ {}; } } #endif