summaryrefslogtreecommitdiff
path: root/boost/spirit/home/phoenix/object/const_cast.hpp
blob: 77f24999c0a6ae51ff06d3cec20ddb607c7d4e81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*=============================================================================
    Copyright (c) 2001-2007 Joel de Guzman

    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 PHOENIX_OBJECT_CONST_CAST_HPP
#define PHOENIX_OBJECT_CONST_CAST_HPP

#include <boost/spirit/home/phoenix/core/compose.hpp>

namespace boost { namespace phoenix
{
    namespace impl
    {
        template <typename T>
        struct const_cast_eval
        {
            template <typename Env, typename U>
            struct result
            {
                typedef T type;
            };

            template <typename RT, typename Env, typename U>
            static RT
            eval(Env const& env, U& obj)
            {
                return const_cast<RT>(obj.eval(env));
            }
        };
    }

    template <typename T, typename U>
    inline actor<typename as_composite<impl::const_cast_eval<T>, U>::type>
    const_cast_(U const& obj)
    {
        return compose<impl::const_cast_eval<T> >(obj);
    }
}}

#endif