Blame view

3rdparty/boost_1_81_0/boost/phoenix/scope/this.hpp 5.55 KB
0b6a182c   Hu Chunming   添加无鉴权注册和注销
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
  /*=============================================================================
      Copyright (c) 2005-2011 Joel de Guzman
      Copyright (c) 2011 Thomas Heller
  
      Distributed under the Boost Software License, Version 1.0. (See accompanying 
      file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  ==============================================================================*/
  #ifndef BOOST_PHOENIX_SCOPE_THIS_HPP
  #define BOOST_PHOENIX_SCOPE_THIS_HPP
  
  #include <boost/phoenix/core/limits.hpp>
  #include <boost/phoenix/core/actor.hpp>
  #include <boost/phoenix/core/environment.hpp>
  #include <boost/phoenix/core/expression.hpp>
  #include <boost/phoenix/core/meta_grammar.hpp>
  #include <boost/phoenix/core/terminal.hpp>
  #include <boost/phoenix/scope/lambda.hpp>
  #include <boost/type_traits/remove_pointer.hpp>
  
  BOOST_PHOENIX_DEFINE_EXPRESSION_VARARG(
      (boost)(phoenix)(this_)
    , (meta_grammar)(meta_grammar)
    , BOOST_PHOENIX_LIMIT
  )
  
  namespace boost { namespace phoenix {
      namespace detail
      {
        /*  
          struct infinite_recursion_detected {};
  
          struct last_non_this_actor
              : proto::or_<
                  proto::when<
                      proto::nary_expr<
                          proto::_
                        , proto::_
                        , proto::_
                      >
                    , proto::_child_c<1>
                  >
                , proto::when<
                      proto::nary_expr<
                          proto::_
                        , proto::_
                        , proto::_
                        , proto::_
                      >
                    , proto::_child_c<2>
                  >
              >
          {};
          */
      }
      struct this_eval
      {
          BOOST_PROTO_CALLABLE()
  
          template <typename Sig>
          struct result;
  
          template <typename This, typename A0, typename Context>
          struct result<This(A0, Context)>
          {
              typedef
                  typename proto::detail::uncvref<
                      typename result_of::env<
                          Context
                      >::type
                  >::type
              outer_env_type;
  
              typedef
                  typename remove_pointer<
                      typename remove_reference<
                          typename fusion::result_of::at_c<
                              outer_env_type
                            , 0
                          >::type
                      >::type
                  >::type
              actor_type;
  
              typedef
                  typename result_of::eval<
                      A0 const &
                    , Context const &
                  >::type
              a0_type;
  
              typedef
                  vector2<actor_type const *, a0_type>
              inner_env_type;
  
              typedef
                  scoped_environment<
                      inner_env_type
                    , outer_env_type
                    , vector0<>
                    , detail::map_local_index_to_tuple<>
                  >
              env_type;
  
              typedef
                  typename result_of::eval<
                      actor_type const &
                    , typename result_of::context<
                          inner_env_type
                        , typename result_of::actions<
                              Context
                          >::type
                      >::type
                  >::type
              type;
          };
  
          template <typename A0, typename Context>
          typename result<this_eval(A0 const&, Context const &)>::type
          operator()(A0 const & a0, Context const & ctx) const
          {
  
              //std::cout << typeid(checker).name() << "\n";
              //std::cout << typeid(checker).name() << "\n";
              typedef
                  typename proto::detail::uncvref<
                      typename result_of::env<
                          Context
                      >::type
                  >::type
              outer_env_type;
  
              typedef
                  typename remove_pointer<
                      typename remove_reference<
                          typename fusion::result_of::at_c<
                              outer_env_type
                            , 0
                          >::type
                       >::type
                  >::type
              actor_type;
  
              typedef
                  typename result_of::eval<
                      A0 const &
                    , Context const &
                  >::type
              a0_type;
  
              typedef
                  vector2<actor_type const *, a0_type>
              inner_env_type;
  
              typedef
                  scoped_environment<
                      inner_env_type
                    , outer_env_type
                    , vector0<>
                    , detail::map_local_index_to_tuple<>
                  >
              env_type;
  
              inner_env_type inner_env = {fusion::at_c<0>(phoenix::env(ctx)), phoenix::eval(a0, ctx)};
              vector0<> locals;
              env_type env(inner_env, phoenix::env(ctx), locals);
  
              return phoenix::eval(*fusion::at_c<0>(phoenix::env(ctx)), phoenix::context(inner_env, phoenix::actions(ctx)));
              //return (*fusion::at_c<0>(phoenix::env(ctx)))(eval(a0, ctx));
          }
      };
  
      template <typename Dummy>
      struct default_actions::when<rule::this_, Dummy>
          : call<this_eval>
      {};
      
      template <typename Dummy>
      struct is_nullary::when<rule::this_, Dummy>
          : proto::make<mpl::false_()>
      {};
      
      template <typename A0>
      typename expression::this_<A0>::type const
      this_(A0 const & a0)
      {
          return expression::this_<A0>::make(a0);
      }
      
  }}
  
  #endif