Imported Upstream version 1.51.0
[platform/upstream/boost.git] / boost / spirit / home / phoenix / object / detail / new_eval.hpp
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 BOOST_PP_IS_ITERATING
8 #ifndef PHOENIX_OBJECT_DETAIL_NEW_EVAL_HPP
9 #define PHOENIX_OBJECT_DETAIL_NEW_EVAL_HPP
10
11 #include <boost/preprocessor/iterate.hpp>
12 #include <boost/preprocessor/cat.hpp>
13 #include <boost/preprocessor/repetition/enum.hpp>
14 #include <boost/preprocessor/repetition/enum_params.hpp>
15 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
16
17 #define PHOENIX_EVAL_ARG(z, n, data)                                            \
18     BOOST_PP_CAT(_, n).eval(env)
19
20 #define BOOST_PP_ITERATION_PARAMS_1                                             \
21     (3, (3, PHOENIX_COMPOSITE_LIMIT,                                            \
22     "boost/spirit/home/phoenix/object/detail/new_eval.hpp"))
23 #include BOOST_PP_ITERATE()
24
25 #undef PHOENIX_EVAL_ARG
26 #endif
27
28 ///////////////////////////////////////////////////////////////////////////////
29 //
30 //  Preprocessor vertical repetition code
31 //
32 ///////////////////////////////////////////////////////////////////////////////
33 #else // defined(BOOST_PP_IS_ITERATING)
34
35 #define N BOOST_PP_ITERATION()
36
37     template <typename RT, typename Env, BOOST_PP_ENUM_PARAMS(N, typename A)>
38     static RT
39     eval(Env const& env, BOOST_PP_ENUM_BINARY_PARAMS(N, A, & _))
40     {
41         return new T(BOOST_PP_ENUM(N, PHOENIX_EVAL_ARG, _));
42     }
43
44 #undef N
45 #endif // defined(BOOST_PP_IS_ITERATING)
46
47