Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/phoenix/statement/throw.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children | c530137014c0 |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
1 /*============================================================================== | |
2 Copyright (c) 2005-2007 Dan Marsden | |
3 Copyright (c) 2005-2010 Joel de Guzman | |
4 Copyright (c) 2010 Thomas Heller | |
5 | |
6 Distributed under the Boost Software License, Version 1.0. (See accompanying | |
7 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
8 ==============================================================================*/ | |
9 #ifndef BOOST_PHOENIX_STATEMENT_THROW_HPP | |
10 #define BOOST_PHOENIX_STATEMENT_THROW_HPP | |
11 | |
12 #include <boost/phoenix/core/limits.hpp> | |
13 #include <boost/phoenix/core/actor.hpp> | |
14 #include <boost/phoenix/core/call.hpp> | |
15 #include <boost/phoenix/core/meta_grammar.hpp> | |
16 #include <boost/phoenix/core/expression.hpp> | |
17 #include <boost/phoenix/core/terminal.hpp> | |
18 #include <boost/phoenix/core/value.hpp> | |
19 | |
20 namespace boost { namespace phoenix | |
21 { | |
22 namespace tag | |
23 { | |
24 struct throw_ {}; | |
25 } | |
26 | |
27 namespace expression | |
28 { | |
29 template <typename A> | |
30 struct throw_ | |
31 : expr<tag::throw_, A> | |
32 {}; | |
33 } | |
34 | |
35 namespace rule | |
36 { | |
37 struct throw_ | |
38 : expression::throw_<meta_grammar> | |
39 {}; | |
40 } | |
41 | |
42 template <typename Dummy> | |
43 struct meta_grammar::case_<tag::throw_, Dummy> | |
44 : enable_rule<rule::throw_, Dummy> | |
45 {}; | |
46 | |
47 struct throw_eval | |
48 { | |
49 typedef void result_type; | |
50 | |
51 template <typename ThrowExpr, typename Context> | |
52 result_type | |
53 operator()(ThrowExpr const& throw_expr, Context const & ctx) const | |
54 { | |
55 throw boost::phoenix::eval(throw_expr, ctx); | |
56 } | |
57 }; | |
58 | |
59 template <typename Dummy> | |
60 struct default_actions::when<rule::throw_, Dummy> | |
61 : call<throw_eval> | |
62 {}; | |
63 | |
64 template <typename ThrowExpr> | |
65 inline | |
66 typename expression::throw_<ThrowExpr>::type const | |
67 throw_(ThrowExpr const& throw_expr) | |
68 { | |
69 return expression::throw_<ThrowExpr>::make(throw_expr); | |
70 } | |
71 | |
72 namespace detail | |
73 { | |
74 struct rethrow {}; | |
75 } | |
76 | |
77 namespace expression | |
78 { | |
79 struct rethrow | |
80 : expression::value<detail::rethrow> | |
81 {}; | |
82 } | |
83 | |
84 template<typename Dummy> | |
85 struct is_custom_terminal<detail::rethrow, Dummy> | |
86 : mpl::true_ | |
87 {}; | |
88 | |
89 template<typename Dummy> | |
90 struct custom_terminal<detail::rethrow, Dummy> | |
91 { | |
92 typedef void result_type; | |
93 | |
94 template <typename Context> | |
95 void operator()(detail::rethrow, Context &) const | |
96 { | |
97 throw; | |
98 } | |
99 }; | |
100 | |
101 inline | |
102 expression::rethrow::type const | |
103 throw_() | |
104 { | |
105 return expression::rethrow::make(detail::rethrow()); | |
106 } | |
107 | |
108 }} | |
109 | |
110 #endif |