1 /*=============================================================================
2 Copyright (c) 2001-2007 Joel de Guzman
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 ==============================================================================*/
7 #ifndef PHOENIX_CORE_COMPOSITE_HPP
8 #define PHOENIX_CORE_COMPOSITE_HPP
10 #include <boost/spirit/home/phoenix/core/actor.hpp>
11 #include <boost/spirit/home/phoenix/core/is_actor.hpp>
12 #include <boost/fusion/include/vector.hpp>
13 #include <boost/fusion/include/at.hpp>
14 #include <boost/fusion/include/size.hpp>
15 #include <boost/fusion/include/mpl.hpp>
16 #include <boost/mpl/fold.hpp>
17 #include <boost/mpl/bool.hpp>
18 #include <boost/mpl/or.hpp>
20 namespace boost { namespace phoenix
25 struct composite_eval;
27 struct compute_no_nullary
29 template <typename State, typename T>
33 mpl::or_<typename T::no_nullary, State>::type
39 template <typename EvalPolicy, typename EvalTuple>
40 struct composite : EvalTuple
42 typedef EvalTuple base_type;
43 typedef composite<EvalPolicy, EvalTuple> self_type;
44 typedef EvalPolicy eval_policy_type;
50 , detail::compute_no_nullary
54 template <typename Env>
58 typename detail::composite_eval<
59 fusion::result_of::size<base_type>::value>::
60 template result<self_type, Env>::type
67 composite(base_type const& base)
70 template <typename U0>
74 template <typename U0, typename U1>
75 composite(U0& _0, U1& _1)
76 : base_type(_0, _1) {}
78 template <typename Env>
79 typename result<Env>::type
80 eval(Env const& env) const
82 typedef typename result<Env>::type return_type;
84 composite_eval<fusion::result_of::size<base_type>::value>::template
85 call<return_type>(*this, env);
88 // Bring in the rest of the constructors
89 #include <boost/spirit/home/phoenix/core/detail/composite.hpp>
92 // Bring in the detail::composite_eval<0..N> definitions
93 #include <boost/spirit/home/phoenix/core/detail/composite_eval.hpp>