]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/phoenix/include/boost/phoenix/statement/throw.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / phoenix / include / boost / phoenix / statement / throw.hpp
CommitLineData
7c673cae
FG
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
20namespace 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 //#ifndef BOOST_PHOENIX_NO_SPECIALIZE_CUSTOM_TERMINAL
94 typedef void _is_throw_custom_terminal; // fix for #7730
95 //#endif
96
97 template <typename Context>
98 void operator()(detail::rethrow, Context &) const
99 {
100 throw;
101 }
102 };
103
104 inline
105 expression::rethrow::type const
106 throw_()
107 {
108 return expression::rethrow::make(detail::rethrow());
109 }
110
111}}
112
113#endif