comparison DEPENDENCIES/generic/include/boost/spirit/home/phoenix/object/construct.hpp @ 16:2665513ce2d3

Add boost headers
author Chris Cannam
date Tue, 05 Aug 2014 11:11:38 +0100
parents
children
comparison
equal deleted inserted replaced
15:663ca0da4350 16:2665513ce2d3
1 /*=============================================================================
2 Copyright (c) 2001-2007 Joel de Guzman
3
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_OBJECT_CONSTRUCT_HPP
8 #define PHOENIX_OBJECT_CONSTRUCT_HPP
9
10 #include <boost/spirit/home/phoenix/core/compose.hpp>
11 #include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
12
13 namespace boost { namespace phoenix
14 {
15 namespace detail
16 {
17 template <typename T>
18 struct construct_eval
19 {
20 template <typename Env,
21 BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
22 PHOENIX_COMPOSITE_LIMIT, typename T, fusion::void_)>
23 struct result
24 {
25 typedef T type;
26 };
27
28 template <typename RT, typename Env>
29 static RT
30 eval(Env const& /*env*/)
31 {
32 return RT();
33 }
34
35 template <typename RT, typename Env, typename A0>
36 static RT
37 eval(Env const& env, A0& _0)
38 {
39 return RT(_0.eval(env));
40 }
41
42 template <typename RT
43 , typename Env, typename A0, typename A1>
44 static RT
45 eval(Env const& env, A0& _0, A1& _1)
46 {
47 return RT(_0.eval(env), _1.eval(env));
48 }
49
50 // Bring in the rest of the evals
51 #include <boost/spirit/home/phoenix/object/detail/construct_eval.hpp>
52 };
53 }
54
55 template <typename T>
56 inline actor<typename as_composite<detail::construct_eval<T> >::type>
57 construct()
58 {
59 return compose<detail::construct_eval<T> >();
60 }
61
62 template <typename T, typename A0>
63 inline actor<typename as_composite<detail::construct_eval<T>, A0>::type>
64 construct(A0 const& _0)
65 {
66 return compose<detail::construct_eval<T> >(_0);
67 }
68
69 template <typename T, typename A0, typename A1>
70 inline actor<typename as_composite<detail::construct_eval<T>, A0, A1>::type>
71 construct(A0 const& _0, A1 const& _1)
72 {
73 return compose<detail::construct_eval<T> >(_0, _1);
74 }
75
76 // Bring in the rest of the new_ functions
77 #include <boost/spirit/home/phoenix/object/detail/construct.hpp>
78 }}
79
80 #endif