1 ///////////////////////////////////////////////////////////////////////////////
2 /// \file callable_eval.hpp
3 /// Contains specializations of the callable_eval\<\> class template.
5 // Copyright 2008 Eric Niebler. Distributed under the Boost
6 // Software License, Version 1.0. (See accompanying file
7 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
10 template<typename Expr, typename Context>
11 struct is_expr_handled<Expr, Context, 1>
13 static callable_context_wrapper<Context> &sctx_;
15 static typename Expr::proto_tag &stag_;
16 static const bool value =
19 detail::check_is_expr_handled(
22 , proto::child_c< 0>( sexpr_)
26 typedef mpl::bool_<value> type;
43 template<typename Expr, typename Context>
44 struct callable_eval<Expr, Context, 1>
46 typedef typename proto::result_of::child_c< Expr const &, 0>::type child0;
48 typename BOOST_PROTO_RESULT_OF<
50 typename Expr::proto_tag
58 result_type operator ()(Expr &expr, Context &context) const
61 typename Expr::proto_tag()
62 , proto::child_c< 0>( expr)
69 template<typename Expr, typename Context>
70 struct is_expr_handled<Expr, Context, 2>
72 static callable_context_wrapper<Context> &sctx_;
74 static typename Expr::proto_tag &stag_;
75 static const bool value =
78 detail::check_is_expr_handled(
81 , proto::child_c< 0>( sexpr_) , proto::child_c< 1>( sexpr_)
85 typedef mpl::bool_<value> type;
102 template<typename Expr, typename Context>
103 struct callable_eval<Expr, Context, 2>
105 typedef typename proto::result_of::child_c< Expr const &, 0>::type child0; typedef typename proto::result_of::child_c< Expr const &, 1>::type child1;
107 typename BOOST_PROTO_RESULT_OF<
109 typename Expr::proto_tag
117 result_type operator ()(Expr &expr, Context &context) const
120 typename Expr::proto_tag()
121 , proto::child_c< 0>( expr) , proto::child_c< 1>( expr)
128 template<typename Expr, typename Context>
129 struct is_expr_handled<Expr, Context, 3>
131 static callable_context_wrapper<Context> &sctx_;
133 static typename Expr::proto_tag &stag_;
134 static const bool value =
137 detail::check_is_expr_handled(
140 , proto::child_c< 0>( sexpr_) , proto::child_c< 1>( sexpr_) , proto::child_c< 2>( sexpr_)
144 typedef mpl::bool_<value> type;
161 template<typename Expr, typename Context>
162 struct callable_eval<Expr, Context, 3>
164 typedef typename proto::result_of::child_c< Expr const &, 0>::type child0; typedef typename proto::result_of::child_c< Expr const &, 1>::type child1; typedef typename proto::result_of::child_c< Expr const &, 2>::type child2;
166 typename BOOST_PROTO_RESULT_OF<
168 typename Expr::proto_tag
169 , child0 , child1 , child2
176 result_type operator ()(Expr &expr, Context &context) const
179 typename Expr::proto_tag()
180 , proto::child_c< 0>( expr) , proto::child_c< 1>( expr) , proto::child_c< 2>( expr)
187 template<typename Expr, typename Context>
188 struct is_expr_handled<Expr, Context, 4>
190 static callable_context_wrapper<Context> &sctx_;
192 static typename Expr::proto_tag &stag_;
193 static const bool value =
196 detail::check_is_expr_handled(
199 , proto::child_c< 0>( sexpr_) , proto::child_c< 1>( sexpr_) , proto::child_c< 2>( sexpr_) , proto::child_c< 3>( sexpr_)
203 typedef mpl::bool_<value> type;
220 template<typename Expr, typename Context>
221 struct callable_eval<Expr, Context, 4>
223 typedef typename proto::result_of::child_c< Expr const &, 0>::type child0; typedef typename proto::result_of::child_c< Expr const &, 1>::type child1; typedef typename proto::result_of::child_c< Expr const &, 2>::type child2; typedef typename proto::result_of::child_c< Expr const &, 3>::type child3;
225 typename BOOST_PROTO_RESULT_OF<
227 typename Expr::proto_tag
228 , child0 , child1 , child2 , child3
235 result_type operator ()(Expr &expr, Context &context) const
238 typename Expr::proto_tag()
239 , proto::child_c< 0>( expr) , proto::child_c< 1>( expr) , proto::child_c< 2>( expr) , proto::child_c< 3>( expr)
246 template<typename Expr, typename Context>
247 struct is_expr_handled<Expr, Context, 5>
249 static callable_context_wrapper<Context> &sctx_;
251 static typename Expr::proto_tag &stag_;
252 static const bool value =
255 detail::check_is_expr_handled(
258 , proto::child_c< 0>( sexpr_) , proto::child_c< 1>( sexpr_) , proto::child_c< 2>( sexpr_) , proto::child_c< 3>( sexpr_) , proto::child_c< 4>( sexpr_)
262 typedef mpl::bool_<value> type;
279 template<typename Expr, typename Context>
280 struct callable_eval<Expr, Context, 5>
282 typedef typename proto::result_of::child_c< Expr const &, 0>::type child0; typedef typename proto::result_of::child_c< Expr const &, 1>::type child1; typedef typename proto::result_of::child_c< Expr const &, 2>::type child2; typedef typename proto::result_of::child_c< Expr const &, 3>::type child3; typedef typename proto::result_of::child_c< Expr const &, 4>::type child4;
284 typename BOOST_PROTO_RESULT_OF<
286 typename Expr::proto_tag
287 , child0 , child1 , child2 , child3 , child4
294 result_type operator ()(Expr &expr, Context &context) const
297 typename Expr::proto_tag()
298 , proto::child_c< 0>( expr) , proto::child_c< 1>( expr) , proto::child_c< 2>( expr) , proto::child_c< 3>( expr) , proto::child_c< 4>( expr)
305 template<typename Expr, typename Context>
306 struct is_expr_handled<Expr, Context, 6>
308 static callable_context_wrapper<Context> &sctx_;
310 static typename Expr::proto_tag &stag_;
311 static const bool value =
314 detail::check_is_expr_handled(
317 , proto::child_c< 0>( sexpr_) , proto::child_c< 1>( sexpr_) , proto::child_c< 2>( sexpr_) , proto::child_c< 3>( sexpr_) , proto::child_c< 4>( sexpr_) , proto::child_c< 5>( sexpr_)
321 typedef mpl::bool_<value> type;
338 template<typename Expr, typename Context>
339 struct callable_eval<Expr, Context, 6>
341 typedef typename proto::result_of::child_c< Expr const &, 0>::type child0; typedef typename proto::result_of::child_c< Expr const &, 1>::type child1; typedef typename proto::result_of::child_c< Expr const &, 2>::type child2; typedef typename proto::result_of::child_c< Expr const &, 3>::type child3; typedef typename proto::result_of::child_c< Expr const &, 4>::type child4; typedef typename proto::result_of::child_c< Expr const &, 5>::type child5;
343 typename BOOST_PROTO_RESULT_OF<
345 typename Expr::proto_tag
346 , child0 , child1 , child2 , child3 , child4 , child5
353 result_type operator ()(Expr &expr, Context &context) const
356 typename Expr::proto_tag()
357 , proto::child_c< 0>( expr) , proto::child_c< 1>( expr) , proto::child_c< 2>( expr) , proto::child_c< 3>( expr) , proto::child_c< 4>( expr) , proto::child_c< 5>( expr)
364 template<typename Expr, typename Context>
365 struct is_expr_handled<Expr, Context, 7>
367 static callable_context_wrapper<Context> &sctx_;
369 static typename Expr::proto_tag &stag_;
370 static const bool value =
373 detail::check_is_expr_handled(
376 , proto::child_c< 0>( sexpr_) , proto::child_c< 1>( sexpr_) , proto::child_c< 2>( sexpr_) , proto::child_c< 3>( sexpr_) , proto::child_c< 4>( sexpr_) , proto::child_c< 5>( sexpr_) , proto::child_c< 6>( sexpr_)
380 typedef mpl::bool_<value> type;
397 template<typename Expr, typename Context>
398 struct callable_eval<Expr, Context, 7>
400 typedef typename proto::result_of::child_c< Expr const &, 0>::type child0; typedef typename proto::result_of::child_c< Expr const &, 1>::type child1; typedef typename proto::result_of::child_c< Expr const &, 2>::type child2; typedef typename proto::result_of::child_c< Expr const &, 3>::type child3; typedef typename proto::result_of::child_c< Expr const &, 4>::type child4; typedef typename proto::result_of::child_c< Expr const &, 5>::type child5; typedef typename proto::result_of::child_c< Expr const &, 6>::type child6;
402 typename BOOST_PROTO_RESULT_OF<
404 typename Expr::proto_tag
405 , child0 , child1 , child2 , child3 , child4 , child5 , child6
412 result_type operator ()(Expr &expr, Context &context) const
415 typename Expr::proto_tag()
416 , proto::child_c< 0>( expr) , proto::child_c< 1>( expr) , proto::child_c< 2>( expr) , proto::child_c< 3>( expr) , proto::child_c< 4>( expr) , proto::child_c< 5>( expr) , proto::child_c< 6>( expr)
423 template<typename Expr, typename Context>
424 struct is_expr_handled<Expr, Context, 8>
426 static callable_context_wrapper<Context> &sctx_;
428 static typename Expr::proto_tag &stag_;
429 static const bool value =
432 detail::check_is_expr_handled(
435 , proto::child_c< 0>( sexpr_) , proto::child_c< 1>( sexpr_) , proto::child_c< 2>( sexpr_) , proto::child_c< 3>( sexpr_) , proto::child_c< 4>( sexpr_) , proto::child_c< 5>( sexpr_) , proto::child_c< 6>( sexpr_) , proto::child_c< 7>( sexpr_)
439 typedef mpl::bool_<value> type;
456 template<typename Expr, typename Context>
457 struct callable_eval<Expr, Context, 8>
459 typedef typename proto::result_of::child_c< Expr const &, 0>::type child0; typedef typename proto::result_of::child_c< Expr const &, 1>::type child1; typedef typename proto::result_of::child_c< Expr const &, 2>::type child2; typedef typename proto::result_of::child_c< Expr const &, 3>::type child3; typedef typename proto::result_of::child_c< Expr const &, 4>::type child4; typedef typename proto::result_of::child_c< Expr const &, 5>::type child5; typedef typename proto::result_of::child_c< Expr const &, 6>::type child6; typedef typename proto::result_of::child_c< Expr const &, 7>::type child7;
461 typename BOOST_PROTO_RESULT_OF<
463 typename Expr::proto_tag
464 , child0 , child1 , child2 , child3 , child4 , child5 , child6 , child7
471 result_type operator ()(Expr &expr, Context &context) const
474 typename Expr::proto_tag()
475 , proto::child_c< 0>( expr) , proto::child_c< 1>( expr) , proto::child_c< 2>( expr) , proto::child_c< 3>( expr) , proto::child_c< 4>( expr) , proto::child_c< 5>( expr) , proto::child_c< 6>( expr) , proto::child_c< 7>( expr)
482 template<typename Expr, typename Context>
483 struct is_expr_handled<Expr, Context, 9>
485 static callable_context_wrapper<Context> &sctx_;
487 static typename Expr::proto_tag &stag_;
488 static const bool value =
491 detail::check_is_expr_handled(
494 , proto::child_c< 0>( sexpr_) , proto::child_c< 1>( sexpr_) , proto::child_c< 2>( sexpr_) , proto::child_c< 3>( sexpr_) , proto::child_c< 4>( sexpr_) , proto::child_c< 5>( sexpr_) , proto::child_c< 6>( sexpr_) , proto::child_c< 7>( sexpr_) , proto::child_c< 8>( sexpr_)
498 typedef mpl::bool_<value> type;
515 template<typename Expr, typename Context>
516 struct callable_eval<Expr, Context, 9>
518 typedef typename proto::result_of::child_c< Expr const &, 0>::type child0; typedef typename proto::result_of::child_c< Expr const &, 1>::type child1; typedef typename proto::result_of::child_c< Expr const &, 2>::type child2; typedef typename proto::result_of::child_c< Expr const &, 3>::type child3; typedef typename proto::result_of::child_c< Expr const &, 4>::type child4; typedef typename proto::result_of::child_c< Expr const &, 5>::type child5; typedef typename proto::result_of::child_c< Expr const &, 6>::type child6; typedef typename proto::result_of::child_c< Expr const &, 7>::type child7; typedef typename proto::result_of::child_c< Expr const &, 8>::type child8;
520 typename BOOST_PROTO_RESULT_OF<
522 typename Expr::proto_tag
523 , child0 , child1 , child2 , child3 , child4 , child5 , child6 , child7 , child8
530 result_type operator ()(Expr &expr, Context &context) const
533 typename Expr::proto_tag()
534 , proto::child_c< 0>( expr) , proto::child_c< 1>( expr) , proto::child_c< 2>( expr) , proto::child_c< 3>( expr) , proto::child_c< 4>( expr) , proto::child_c< 5>( expr) , proto::child_c< 6>( expr) , proto::child_c< 7>( expr) , proto::child_c< 8>( expr)
541 template<typename Expr, typename Context>
542 struct is_expr_handled<Expr, Context, 10>
544 static callable_context_wrapper<Context> &sctx_;
546 static typename Expr::proto_tag &stag_;
547 static const bool value =
550 detail::check_is_expr_handled(
553 , proto::child_c< 0>( sexpr_) , proto::child_c< 1>( sexpr_) , proto::child_c< 2>( sexpr_) , proto::child_c< 3>( sexpr_) , proto::child_c< 4>( sexpr_) , proto::child_c< 5>( sexpr_) , proto::child_c< 6>( sexpr_) , proto::child_c< 7>( sexpr_) , proto::child_c< 8>( sexpr_) , proto::child_c< 9>( sexpr_)
557 typedef mpl::bool_<value> type;
574 template<typename Expr, typename Context>
575 struct callable_eval<Expr, Context, 10>
577 typedef typename proto::result_of::child_c< Expr const &, 0>::type child0; typedef typename proto::result_of::child_c< Expr const &, 1>::type child1; typedef typename proto::result_of::child_c< Expr const &, 2>::type child2; typedef typename proto::result_of::child_c< Expr const &, 3>::type child3; typedef typename proto::result_of::child_c< Expr const &, 4>::type child4; typedef typename proto::result_of::child_c< Expr const &, 5>::type child5; typedef typename proto::result_of::child_c< Expr const &, 6>::type child6; typedef typename proto::result_of::child_c< Expr const &, 7>::type child7; typedef typename proto::result_of::child_c< Expr const &, 8>::type child8; typedef typename proto::result_of::child_c< Expr const &, 9>::type child9;
579 typename BOOST_PROTO_RESULT_OF<
581 typename Expr::proto_tag
582 , child0 , child1 , child2 , child3 , child4 , child5 , child6 , child7 , child8 , child9
589 result_type operator ()(Expr &expr, Context &context) const
592 typename Expr::proto_tag()
593 , proto::child_c< 0>( expr) , proto::child_c< 1>( expr) , proto::child_c< 2>( expr) , proto::child_c< 3>( expr) , proto::child_c< 4>( expr) , proto::child_c< 5>( expr) , proto::child_c< 6>( expr) , proto::child_c< 7>( expr) , proto::child_c< 8>( expr) , proto::child_c< 9>( expr)