1 /*=============================================================================
2 Copyright (c) 2005-2007 Dan Marsden
3 Copyright (c) 2005-2007 Joel de Guzman
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 ==============================================================================*/
9 #ifndef PHOENIX_STATEMENT_DETAIL_CATCH_COMPOSITE_HPP
10 #define PHOENIX_STATEMENT_DETAIL_CATCH_COMPOSITE_HPP
12 #include <boost/spirit/home/phoenix/core/actor.hpp>
13 #include <boost/spirit/home/phoenix/core/composite.hpp>
14 #include <boost/spirit/home/phoenix/core/compose.hpp>
16 namespace boost { namespace phoenix {
19 struct catch_composite_eval
21 template<typename Env, typename Actor>
23 eval_result<typename Actor::eval_type, Env> {};
25 template<typename Rt, typename Env, typename Actor>
26 static typename result<Env,Actor>::type
27 eval(const Env& env, Actor& actor)
29 return actor.eval(env);
33 template<typename Exception, typename Actor>
34 struct catch_composite :
35 composite<catch_composite_eval, fusion::vector<Actor> >
37 catch_composite(const Actor& actor)
38 : composite<catch_composite_eval, fusion::vector<Actor> >(actor) { }
40 typedef Exception exception_type;
43 template<typename Exception, typename Actor>
46 typedef catch_composite<
50 typedef actor<comp> type;
53 template<typename Exception, typename Actor>
54 inline typename as_catch_actor<Exception, Actor>::type
55 catch_actor(const Actor& actor)
57 return catch_composite<Exception,Actor>(actor);