comparison DEPENDENCIES/generic/include/boost/phoenix/object/static_cast.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-2010 Joel de Guzman
3 Copyright (c) 2010 Thomas Heller
4
5 Distributed under the Boost Software License, Version 1.0. (See accompanying
6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 ==============================================================================*/
8 #ifndef BOOST_PHOENIX_OBJECT_STATIC_CAST_HPP
9 #define BOOST_PHOENIX_OBJECT_STATIC_CAST_HPP
10
11 #include <boost/phoenix/core/limits.hpp>
12 #include <boost/phoenix/core/call.hpp>
13 #include <boost/phoenix/core/expression.hpp>
14 #include <boost/phoenix/core/meta_grammar.hpp>
15 #include <boost/phoenix/object/detail/target.hpp>
16 #include <boost/proto/transform/lazy.hpp>
17
18 BOOST_PHOENIX_DEFINE_EXPRESSION(
19 (boost)(phoenix)(static_cast_)
20 , (proto::terminal<detail::target<proto::_> >)
21 (meta_grammar)
22 )
23
24 namespace boost { namespace phoenix
25 {
26 struct static_cast_eval
27 {
28 template <typename Sig>
29 struct result;
30
31 template <typename This, typename Target, typename Source, typename Context>
32 struct result<This(Target, Source, Context)>
33 : detail::result_of::target<Target>
34 {};
35
36 template <typename Target, typename Source, typename Context>
37 typename detail::result_of::target<Target>::type
38 operator()(Target, Source const& u, Context const& ctx) const
39 {
40 return static_cast<
41 typename detail::result_of::target<Target>::type
42 >(boost::phoenix::eval(u, ctx));
43 }
44 };
45
46 template <typename Dummy>
47 struct default_actions::when<rule::static_cast_, Dummy>
48 : call<static_cast_eval, Dummy>
49 {};
50
51 template <typename T, typename U>
52 inline
53 typename expression::static_cast_<detail::target<T>, U>::type const
54 static_cast_(U const& u)
55 {
56 return
57 expression::
58 static_cast_<detail::target<T>, U>::
59 make(detail::target<T>(), u);
60 }
61 }}
62
63 #endif