Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:47:40

0001 /*==============================================================================
0002     Copyright (c) 2005-2007 Dan Marsden
0003     Copyright (c) 2005-2010 Joel de Guzman
0004     Copyright (c) 2010 Thomas Heller
0005 
0006     Distributed under the Boost Software License, Version 1.0. (See accompanying
0007     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0008 ==============================================================================*/
0009 #ifndef BOOST_PHOENIX_STATEMENT_THROW_HPP
0010 #define BOOST_PHOENIX_STATEMENT_THROW_HPP
0011 
0012 #include <boost/phoenix/core/limits.hpp>
0013 #include <boost/phoenix/core/actor.hpp>
0014 #include <boost/phoenix/core/call.hpp>
0015 #include <boost/phoenix/core/meta_grammar.hpp>
0016 #include <boost/phoenix/core/expression.hpp>
0017 #include <boost/phoenix/core/terminal.hpp>
0018 #include <boost/phoenix/core/value.hpp>
0019 
0020 namespace boost { namespace phoenix
0021 {
0022     namespace tag
0023     {
0024         struct throw_ {};
0025     }
0026 
0027     namespace expression
0028     {
0029         template <typename A>
0030         struct throw_
0031             : expr<tag::throw_, A>
0032         {};
0033     }
0034 
0035     namespace rule
0036     {
0037         struct throw_
0038             : expression::throw_<meta_grammar>
0039         {};
0040     }
0041 
0042     template <typename Dummy>
0043     struct meta_grammar::case_<tag::throw_, Dummy>
0044         : enable_rule<rule::throw_, Dummy>
0045     {};
0046 
0047     struct throw_eval
0048     {
0049         typedef void result_type;
0050 
0051         template <typename ThrowExpr, typename Context>
0052         result_type
0053         operator()(ThrowExpr const& throw_expr, Context const & ctx) const
0054         {
0055             throw boost::phoenix::eval(throw_expr, ctx);
0056         }
0057     };
0058     
0059     template <typename Dummy>
0060     struct default_actions::when<rule::throw_, Dummy>
0061         : call<throw_eval>
0062     {};
0063 
0064     template <typename ThrowExpr>
0065     inline
0066     typename expression::throw_<ThrowExpr>::type const
0067     throw_(ThrowExpr const& throw_expr)
0068     {
0069         return expression::throw_<ThrowExpr>::make(throw_expr);
0070     }
0071     
0072     namespace detail
0073     {
0074         struct rethrow {};
0075     }
0076     
0077     namespace expression
0078     {
0079         struct rethrow
0080             : expression::value<detail::rethrow>
0081         {};
0082     }
0083     
0084     template<typename Dummy>
0085     struct is_custom_terminal<detail::rethrow, Dummy>
0086       : mpl::true_
0087     {};
0088 
0089     template<typename Dummy>
0090     struct custom_terminal<detail::rethrow, Dummy>
0091     {
0092         typedef void result_type;
0093       //#ifndef BOOST_PHOENIX_NO_SPECIALIZE_CUSTOM_TERMINAL
0094         typedef void _is_throw_custom_terminal; // fix for #7730
0095       //#endif
0096 
0097         template <typename Context>
0098         void operator()(detail::rethrow, Context &) const
0099         {
0100             throw;
0101         }
0102     };
0103 
0104     inline
0105     expression::rethrow::type const
0106     throw_()
0107     {
0108         return expression::rethrow::make(detail::rethrow());
0109     }
0110 
0111 }}
0112 
0113 #endif