1 /*=============================================================================
2 Copyright (c) 2005-2011 Joel de Guzman
3 Copyright (c) 2011 Thomas Heller
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_SCOPE_THIS_HPP
9 #define BOOST_PHOENIX_SCOPE_THIS_HPP
11 #include <boost/phoenix/core/limits.hpp>
12 #include <boost/phoenix/core/actor.hpp>
13 #include <boost/phoenix/core/environment.hpp>
14 #include <boost/phoenix/core/expression.hpp>
15 #include <boost/phoenix/core/meta_grammar.hpp>
16 #include <boost/phoenix/core/terminal.hpp>
17 #include <boost/phoenix/scope/lambda.hpp>
18 #include <boost/type_traits/remove_pointer.hpp>
20 BOOST_PHOENIX_DEFINE_EXPRESSION_VARARG(
21 (boost)(phoenix)(this_)
22 , (meta_grammar)(meta_grammar)
26 namespace boost { namespace phoenix {
30 struct infinite_recursion_detected {};
32 struct last_non_this_actor
57 BOOST_PROTO_CALLABLE()
59 template <typename Sig>
62 template <typename This, typename A0, typename Context>
63 struct result<This(A0, Context)>
66 typename proto::detail::uncvref<
67 typename result_of::env<
74 typename remove_pointer<
75 typename remove_reference<
76 typename fusion::result_of::at_c<
85 typename result_of::eval<
92 vector2<actor_type const *, a0_type>
100 , detail::map_local_index_to_tuple<>
105 typename result_of::eval<
107 , typename result_of::context<
109 , typename result_of::actions<
117 template <typename A0, typename Context>
118 typename result<this_eval(A0 const&, Context const &)>::type
119 operator()(A0 const & a0, Context const & ctx) const
122 //std::cout << typeid(checker).name() << "\n";
123 //std::cout << typeid(checker).name() << "\n";
125 typename proto::detail::uncvref<
126 typename result_of::env<
133 typename remove_pointer<
134 typename remove_reference<
135 typename fusion::result_of::at_c<
144 typename result_of::eval<
151 vector2<actor_type const *, a0_type>
159 , detail::map_local_index_to_tuple<>
163 inner_env_type inner_env = {fusion::at_c<0>(phoenix::env(ctx)), phoenix::eval(a0, ctx)};
165 env_type env(inner_env, phoenix::env(ctx), locals);
167 return phoenix::eval(*fusion::at_c<0>(phoenix::env(ctx)), phoenix::context(inner_env, phoenix::actions(ctx)));
168 //return (*fusion::at_c<0>(phoenix::env(ctx)))(eval(a0, ctx));
172 template <typename Dummy>
173 struct default_actions::when<rule::this_, Dummy>
177 template <typename Dummy>
178 struct is_nullary::when<rule::this_, Dummy>
179 : proto::make<mpl::false_()>
182 template <typename A0>
183 typename expression::this_<A0>::type const
186 return expression::this_<A0>::make(a0);