PageRenderTime 22ms CodeModel.GetById 17ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

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

http://hadesmem.googlecode.com/
C++ Header | 42 lines | 31 code | 5 blank | 6 comment | 0 complexity | a6831f2b3220289400baf4cc5019b6b2 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_DYNAMIC_CAST_HPP
 8#define PHOENIX_OBJECT_DYNAMIC_CAST_HPP
 9
10#include <boost/spirit/home/phoenix/core/compose.hpp>
11
12namespace boost { namespace phoenix
13{
14    namespace impl
15    {
16        template <typename T>
17        struct dynamic_cast_eval
18        {
19            template <typename Env, typename U>
20            struct result
21            {
22                typedef T type;
23            };
24
25            template <typename RT, typename Env, typename U>
26            static RT
27            eval(Env const& env, U& obj)
28            {
29                return dynamic_cast<RT>(obj.eval(env));
30            }
31        };
32    }
33
34    template <typename T, typename U>
35    inline actor<typename as_composite<impl::dynamic_cast_eval<T>, U>::type>
36    dynamic_cast_(U const& obj)
37    {
38        return compose<impl::dynamic_cast_eval<T> >(obj);
39    }
40}}
41
42#endif