Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:50:19

0001     ///////////////////////////////////////////////////////////////////////////////
0002     /// \file callable_eval.hpp
0003     /// Contains specializations of the callable_eval\<\> class template.
0004     //
0005     //  Copyright 2008 Eric Niebler. Distributed under the Boost
0006     //  Software License, Version 1.0. (See accompanying file
0007     //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0008     namespace detail
0009     {
0010         template<typename Expr, typename Context>
0011         struct is_expr_handled<Expr, Context, 1>
0012         {
0013             static callable_context_wrapper<Context> &sctx_;
0014             static Expr &sexpr_;
0015             static typename Expr::proto_tag &stag_;
0016             static const bool value =
0017                 sizeof(yes_type) ==
0018                 sizeof(
0019                     detail::check_is_expr_handled(
0020                         (sctx_(
0021                             stag_
0022                             , proto::child_c< 0>( sexpr_)
0023                         ), 0)
0024                     )
0025                 );
0026             typedef mpl::bool_<value> type;
0027         };
0028     }
0029     namespace context
0030     {
0031         
0032         
0033         
0034         
0035         
0036         
0037         
0038         
0039         
0040         
0041         
0042         
0043         template<typename Expr, typename Context>
0044         struct callable_eval<Expr, Context, 1>
0045         {
0046             typedef typename proto::result_of::child_c< Expr const &, 0>::type child0;
0047             typedef
0048                 typename BOOST_PROTO_RESULT_OF<
0049                     Context(
0050                         typename Expr::proto_tag
0051                         , child0
0052                     )
0053                 >::type
0054             result_type;
0055             
0056             
0057             
0058             result_type operator ()(Expr &expr, Context &context) const
0059             {
0060                 return context(
0061                     typename Expr::proto_tag()
0062                     , proto::child_c< 0>( expr)
0063                 );
0064             }
0065         };
0066     }
0067     namespace detail
0068     {
0069         template<typename Expr, typename Context>
0070         struct is_expr_handled<Expr, Context, 2>
0071         {
0072             static callable_context_wrapper<Context> &sctx_;
0073             static Expr &sexpr_;
0074             static typename Expr::proto_tag &stag_;
0075             static const bool value =
0076                 sizeof(yes_type) ==
0077                 sizeof(
0078                     detail::check_is_expr_handled(
0079                         (sctx_(
0080                             stag_
0081                             , proto::child_c< 0>( sexpr_) , proto::child_c< 1>( sexpr_)
0082                         ), 0)
0083                     )
0084                 );
0085             typedef mpl::bool_<value> type;
0086         };
0087     }
0088     namespace context
0089     {
0090         
0091         
0092         
0093         
0094         
0095         
0096         
0097         
0098         
0099         
0100         
0101         
0102         template<typename Expr, typename Context>
0103         struct callable_eval<Expr, Context, 2>
0104         {
0105             typedef typename proto::result_of::child_c< Expr const &, 0>::type child0; typedef typename proto::result_of::child_c< Expr const &, 1>::type child1;
0106             typedef
0107                 typename BOOST_PROTO_RESULT_OF<
0108                     Context(
0109                         typename Expr::proto_tag
0110                         , child0 , child1
0111                     )
0112                 >::type
0113             result_type;
0114             
0115             
0116             
0117             result_type operator ()(Expr &expr, Context &context) const
0118             {
0119                 return context(
0120                     typename Expr::proto_tag()
0121                     , proto::child_c< 0>( expr) , proto::child_c< 1>( expr)
0122                 );
0123             }
0124         };
0125     }
0126     namespace detail
0127     {
0128         template<typename Expr, typename Context>
0129         struct is_expr_handled<Expr, Context, 3>
0130         {
0131             static callable_context_wrapper<Context> &sctx_;
0132             static Expr &sexpr_;
0133             static typename Expr::proto_tag &stag_;
0134             static const bool value =
0135                 sizeof(yes_type) ==
0136                 sizeof(
0137                     detail::check_is_expr_handled(
0138                         (sctx_(
0139                             stag_
0140                             , proto::child_c< 0>( sexpr_) , proto::child_c< 1>( sexpr_) , proto::child_c< 2>( sexpr_)
0141                         ), 0)
0142                     )
0143                 );
0144             typedef mpl::bool_<value> type;
0145         };
0146     }
0147     namespace context
0148     {
0149         
0150         
0151         
0152         
0153         
0154         
0155         
0156         
0157         
0158         
0159         
0160         
0161         template<typename Expr, typename Context>
0162         struct callable_eval<Expr, Context, 3>
0163         {
0164             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;
0165             typedef
0166                 typename BOOST_PROTO_RESULT_OF<
0167                     Context(
0168                         typename Expr::proto_tag
0169                         , child0 , child1 , child2
0170                     )
0171                 >::type
0172             result_type;
0173             
0174             
0175             
0176             result_type operator ()(Expr &expr, Context &context) const
0177             {
0178                 return context(
0179                     typename Expr::proto_tag()
0180                     , proto::child_c< 0>( expr) , proto::child_c< 1>( expr) , proto::child_c< 2>( expr)
0181                 );
0182             }
0183         };
0184     }
0185     namespace detail
0186     {
0187         template<typename Expr, typename Context>
0188         struct is_expr_handled<Expr, Context, 4>
0189         {
0190             static callable_context_wrapper<Context> &sctx_;
0191             static Expr &sexpr_;
0192             static typename Expr::proto_tag &stag_;
0193             static const bool value =
0194                 sizeof(yes_type) ==
0195                 sizeof(
0196                     detail::check_is_expr_handled(
0197                         (sctx_(
0198                             stag_
0199                             , proto::child_c< 0>( sexpr_) , proto::child_c< 1>( sexpr_) , proto::child_c< 2>( sexpr_) , proto::child_c< 3>( sexpr_)
0200                         ), 0)
0201                     )
0202                 );
0203             typedef mpl::bool_<value> type;
0204         };
0205     }
0206     namespace context
0207     {
0208         
0209         
0210         
0211         
0212         
0213         
0214         
0215         
0216         
0217         
0218         
0219         
0220         template<typename Expr, typename Context>
0221         struct callable_eval<Expr, Context, 4>
0222         {
0223             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;
0224             typedef
0225                 typename BOOST_PROTO_RESULT_OF<
0226                     Context(
0227                         typename Expr::proto_tag
0228                         , child0 , child1 , child2 , child3
0229                     )
0230                 >::type
0231             result_type;
0232             
0233             
0234             
0235             result_type operator ()(Expr &expr, Context &context) const
0236             {
0237                 return context(
0238                     typename Expr::proto_tag()
0239                     , proto::child_c< 0>( expr) , proto::child_c< 1>( expr) , proto::child_c< 2>( expr) , proto::child_c< 3>( expr)
0240                 );
0241             }
0242         };
0243     }
0244     namespace detail
0245     {
0246         template<typename Expr, typename Context>
0247         struct is_expr_handled<Expr, Context, 5>
0248         {
0249             static callable_context_wrapper<Context> &sctx_;
0250             static Expr &sexpr_;
0251             static typename Expr::proto_tag &stag_;
0252             static const bool value =
0253                 sizeof(yes_type) ==
0254                 sizeof(
0255                     detail::check_is_expr_handled(
0256                         (sctx_(
0257                             stag_
0258                             , 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_)
0259                         ), 0)
0260                     )
0261                 );
0262             typedef mpl::bool_<value> type;
0263         };
0264     }
0265     namespace context
0266     {
0267         
0268         
0269         
0270         
0271         
0272         
0273         
0274         
0275         
0276         
0277         
0278         
0279         template<typename Expr, typename Context>
0280         struct callable_eval<Expr, Context, 5>
0281         {
0282             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;
0283             typedef
0284                 typename BOOST_PROTO_RESULT_OF<
0285                     Context(
0286                         typename Expr::proto_tag
0287                         , child0 , child1 , child2 , child3 , child4
0288                     )
0289                 >::type
0290             result_type;
0291             
0292             
0293             
0294             result_type operator ()(Expr &expr, Context &context) const
0295             {
0296                 return context(
0297                     typename Expr::proto_tag()
0298                     , 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)
0299                 );
0300             }
0301         };
0302     }
0303     namespace detail
0304     {
0305         template<typename Expr, typename Context>
0306         struct is_expr_handled<Expr, Context, 6>
0307         {
0308             static callable_context_wrapper<Context> &sctx_;
0309             static Expr &sexpr_;
0310             static typename Expr::proto_tag &stag_;
0311             static const bool value =
0312                 sizeof(yes_type) ==
0313                 sizeof(
0314                     detail::check_is_expr_handled(
0315                         (sctx_(
0316                             stag_
0317                             , 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_)
0318                         ), 0)
0319                     )
0320                 );
0321             typedef mpl::bool_<value> type;
0322         };
0323     }
0324     namespace context
0325     {
0326         
0327         
0328         
0329         
0330         
0331         
0332         
0333         
0334         
0335         
0336         
0337         
0338         template<typename Expr, typename Context>
0339         struct callable_eval<Expr, Context, 6>
0340         {
0341             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;
0342             typedef
0343                 typename BOOST_PROTO_RESULT_OF<
0344                     Context(
0345                         typename Expr::proto_tag
0346                         , child0 , child1 , child2 , child3 , child4 , child5
0347                     )
0348                 >::type
0349             result_type;
0350             
0351             
0352             
0353             result_type operator ()(Expr &expr, Context &context) const
0354             {
0355                 return context(
0356                     typename Expr::proto_tag()
0357                     , 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)
0358                 );
0359             }
0360         };
0361     }
0362     namespace detail
0363     {
0364         template<typename Expr, typename Context>
0365         struct is_expr_handled<Expr, Context, 7>
0366         {
0367             static callable_context_wrapper<Context> &sctx_;
0368             static Expr &sexpr_;
0369             static typename Expr::proto_tag &stag_;
0370             static const bool value =
0371                 sizeof(yes_type) ==
0372                 sizeof(
0373                     detail::check_is_expr_handled(
0374                         (sctx_(
0375                             stag_
0376                             , 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_)
0377                         ), 0)
0378                     )
0379                 );
0380             typedef mpl::bool_<value> type;
0381         };
0382     }
0383     namespace context
0384     {
0385         
0386         
0387         
0388         
0389         
0390         
0391         
0392         
0393         
0394         
0395         
0396         
0397         template<typename Expr, typename Context>
0398         struct callable_eval<Expr, Context, 7>
0399         {
0400             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;
0401             typedef
0402                 typename BOOST_PROTO_RESULT_OF<
0403                     Context(
0404                         typename Expr::proto_tag
0405                         , child0 , child1 , child2 , child3 , child4 , child5 , child6
0406                     )
0407                 >::type
0408             result_type;
0409             
0410             
0411             
0412             result_type operator ()(Expr &expr, Context &context) const
0413             {
0414                 return context(
0415                     typename Expr::proto_tag()
0416                     , 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)
0417                 );
0418             }
0419         };
0420     }
0421     namespace detail
0422     {
0423         template<typename Expr, typename Context>
0424         struct is_expr_handled<Expr, Context, 8>
0425         {
0426             static callable_context_wrapper<Context> &sctx_;
0427             static Expr &sexpr_;
0428             static typename Expr::proto_tag &stag_;
0429             static const bool value =
0430                 sizeof(yes_type) ==
0431                 sizeof(
0432                     detail::check_is_expr_handled(
0433                         (sctx_(
0434                             stag_
0435                             , 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_)
0436                         ), 0)
0437                     )
0438                 );
0439             typedef mpl::bool_<value> type;
0440         };
0441     }
0442     namespace context
0443     {
0444         
0445         
0446         
0447         
0448         
0449         
0450         
0451         
0452         
0453         
0454         
0455         
0456         template<typename Expr, typename Context>
0457         struct callable_eval<Expr, Context, 8>
0458         {
0459             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;
0460             typedef
0461                 typename BOOST_PROTO_RESULT_OF<
0462                     Context(
0463                         typename Expr::proto_tag
0464                         , child0 , child1 , child2 , child3 , child4 , child5 , child6 , child7
0465                     )
0466                 >::type
0467             result_type;
0468             
0469             
0470             
0471             result_type operator ()(Expr &expr, Context &context) const
0472             {
0473                 return context(
0474                     typename Expr::proto_tag()
0475                     , 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)
0476                 );
0477             }
0478         };
0479     }
0480     namespace detail
0481     {
0482         template<typename Expr, typename Context>
0483         struct is_expr_handled<Expr, Context, 9>
0484         {
0485             static callable_context_wrapper<Context> &sctx_;
0486             static Expr &sexpr_;
0487             static typename Expr::proto_tag &stag_;
0488             static const bool value =
0489                 sizeof(yes_type) ==
0490                 sizeof(
0491                     detail::check_is_expr_handled(
0492                         (sctx_(
0493                             stag_
0494                             , 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_)
0495                         ), 0)
0496                     )
0497                 );
0498             typedef mpl::bool_<value> type;
0499         };
0500     }
0501     namespace context
0502     {
0503         
0504         
0505         
0506         
0507         
0508         
0509         
0510         
0511         
0512         
0513         
0514         
0515         template<typename Expr, typename Context>
0516         struct callable_eval<Expr, Context, 9>
0517         {
0518             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;
0519             typedef
0520                 typename BOOST_PROTO_RESULT_OF<
0521                     Context(
0522                         typename Expr::proto_tag
0523                         , child0 , child1 , child2 , child3 , child4 , child5 , child6 , child7 , child8
0524                     )
0525                 >::type
0526             result_type;
0527             
0528             
0529             
0530             result_type operator ()(Expr &expr, Context &context) const
0531             {
0532                 return context(
0533                     typename Expr::proto_tag()
0534                     , 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)
0535                 );
0536             }
0537         };
0538     }
0539     namespace detail
0540     {
0541         template<typename Expr, typename Context>
0542         struct is_expr_handled<Expr, Context, 10>
0543         {
0544             static callable_context_wrapper<Context> &sctx_;
0545             static Expr &sexpr_;
0546             static typename Expr::proto_tag &stag_;
0547             static const bool value =
0548                 sizeof(yes_type) ==
0549                 sizeof(
0550                     detail::check_is_expr_handled(
0551                         (sctx_(
0552                             stag_
0553                             , 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_)
0554                         ), 0)
0555                     )
0556                 );
0557             typedef mpl::bool_<value> type;
0558         };
0559     }
0560     namespace context
0561     {
0562         
0563         
0564         
0565         
0566         
0567         
0568         
0569         
0570         
0571         
0572         
0573         
0574         template<typename Expr, typename Context>
0575         struct callable_eval<Expr, Context, 10>
0576         {
0577             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;
0578             typedef
0579                 typename BOOST_PROTO_RESULT_OF<
0580                     Context(
0581                         typename Expr::proto_tag
0582                         , child0 , child1 , child2 , child3 , child4 , child5 , child6 , child7 , child8 , child9
0583                     )
0584                 >::type
0585             result_type;
0586             
0587             
0588             
0589             result_type operator ()(Expr &expr, Context &context) const
0590             {
0591                 return context(
0592                     typename Expr::proto_tag()
0593                     , 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)
0594                 );
0595             }
0596         };
0597     }