PageRenderTime 45ms CodeModel.GetById 32ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/spirit/home/phoenix/object/new.hpp

http://hadesmem.googlecode.com/
C++ Header | 80 lines | 61 code | 11 blank | 8 comment | 0 complexity | 8a76b50ce38febb0113f86e7040cdac7 MD5 | raw file
 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_NEW_HPP
 8#define PHOENIX_OBJECT_NEW_HPP
 9
10#include <boost/spirit/home/phoenix/core/compose.hpp>
11#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
12
13namespace boost { namespace phoenix
14{
15    namespace detail
16    {
17        template <typename T>
18        struct new_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 new T;
33            }
34
35            template <typename RT, typename Env, typename A0>
36            static RT
37            eval(Env const& env, A0& _0)
38            {
39                return new T(_0.eval(env));
40            }
41
42            template <typename RT, typename Env
43              , typename A0, typename A1>
44            static RT
45            eval(Env const& env, A0& _0, A1& _1)
46            {
47                return new T(_0.eval(env), _1.eval(env));
48            }
49
50            //  Bring in the rest of the evals
51            #include <boost/spirit/home/phoenix/object/detail/new_eval.hpp>
52        };
53    }
54
55    template <typename T>
56    inline actor<typename as_composite<detail::new_eval<T> >::type>
57    new_()
58    {
59        return compose<detail::new_eval<T> >();
60    }
61
62    template <typename T, typename A0>
63    inline actor<typename as_composite<detail::new_eval<T>, A0>::type>
64    new_(A0 const& _0)
65    {
66        return compose<detail::new_eval<T> >(_0);
67    }
68
69    template <typename T, typename A0, typename A1>
70    inline actor<typename as_composite<detail::new_eval<T>, A0, A1>::type>
71    new_(A0 const& _0, A1 const& _1)
72    {
73        return compose<detail::new_eval<T> >(_0, _1);
74    }
75
76    //  Bring in the rest of the new_ functions
77    #include <boost/spirit/home/phoenix/object/detail/new.hpp>
78}}
79
80#endif