Back to home page

EIC code displayed by LXR

 
 

    


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

0001     ///////////////////////////////////////////////////////////////////////////////
0002     /// \file default_eval.hpp
0003     /// Contains specializations of the default_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     template<typename Expr, typename Context>
0009     struct default_eval<Expr, Context, proto::tag::function, 3>
0010     {
0011         typedef
0012             typename proto::detail::result_of_fixup<
0013                 typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 0>::type >::type , Context >::type
0014             >::type
0015         function_type;
0016         typedef
0017             typename BOOST_PROTO_RESULT_OF<
0018                 function_type(typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 1>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 2>::type >::type , Context >::type)
0019             >::type
0020         result_type;
0021         result_type operator ()(Expr &expr, Context &context) const
0022         {
0023             return this->invoke(expr, context, is_member_function_pointer<function_type>());
0024         }
0025     private:
0026         result_type invoke(Expr &expr, Context &context, mpl::false_) const
0027         {
0028             return proto::eval(proto::child_c< 0>( expr), context)(
0029                 proto::eval(proto::child_c< 1>( expr), context) , proto::eval(proto::child_c< 2>( expr), context)
0030             );
0031         }
0032         result_type invoke(Expr &expr, Context &context, mpl::true_) const
0033         {
0034             BOOST_PROTO_USE_GET_POINTER();
0035             typedef typename detail::class_member_traits<function_type>::class_type class_type;
0036             return (
0037                 BOOST_PROTO_GET_POINTER(class_type, (proto::eval(proto::child_c< 1>( expr), context))) ->*
0038                 proto::eval(proto::child_c< 0>( expr), context)
0039             )(proto::eval(proto::child_c< 2>( expr), context));
0040         }
0041     };
0042     template<typename Expr, typename Context>
0043     struct default_eval<Expr, Context, proto::tag::function, 4>
0044     {
0045         typedef
0046             typename proto::detail::result_of_fixup<
0047                 typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 0>::type >::type , Context >::type
0048             >::type
0049         function_type;
0050         typedef
0051             typename BOOST_PROTO_RESULT_OF<
0052                 function_type(typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 1>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 2>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 3>::type >::type , Context >::type)
0053             >::type
0054         result_type;
0055         result_type operator ()(Expr &expr, Context &context) const
0056         {
0057             return this->invoke(expr, context, is_member_function_pointer<function_type>());
0058         }
0059     private:
0060         result_type invoke(Expr &expr, Context &context, mpl::false_) const
0061         {
0062             return proto::eval(proto::child_c< 0>( expr), context)(
0063                 proto::eval(proto::child_c< 1>( expr), context) , proto::eval(proto::child_c< 2>( expr), context) , proto::eval(proto::child_c< 3>( expr), context)
0064             );
0065         }
0066         result_type invoke(Expr &expr, Context &context, mpl::true_) const
0067         {
0068             BOOST_PROTO_USE_GET_POINTER();
0069             typedef typename detail::class_member_traits<function_type>::class_type class_type;
0070             return (
0071                 BOOST_PROTO_GET_POINTER(class_type, (proto::eval(proto::child_c< 1>( expr), context))) ->*
0072                 proto::eval(proto::child_c< 0>( expr), context)
0073             )(proto::eval(proto::child_c< 2>( expr), context) , proto::eval(proto::child_c< 3>( expr), context));
0074         }
0075     };
0076     template<typename Expr, typename Context>
0077     struct default_eval<Expr, Context, proto::tag::function, 5>
0078     {
0079         typedef
0080             typename proto::detail::result_of_fixup<
0081                 typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 0>::type >::type , Context >::type
0082             >::type
0083         function_type;
0084         typedef
0085             typename BOOST_PROTO_RESULT_OF<
0086                 function_type(typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 1>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 2>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 3>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 4>::type >::type , Context >::type)
0087             >::type
0088         result_type;
0089         result_type operator ()(Expr &expr, Context &context) const
0090         {
0091             return this->invoke(expr, context, is_member_function_pointer<function_type>());
0092         }
0093     private:
0094         result_type invoke(Expr &expr, Context &context, mpl::false_) const
0095         {
0096             return proto::eval(proto::child_c< 0>( expr), context)(
0097                 proto::eval(proto::child_c< 1>( expr), context) , proto::eval(proto::child_c< 2>( expr), context) , proto::eval(proto::child_c< 3>( expr), context) , proto::eval(proto::child_c< 4>( expr), context)
0098             );
0099         }
0100         result_type invoke(Expr &expr, Context &context, mpl::true_) const
0101         {
0102             BOOST_PROTO_USE_GET_POINTER();
0103             typedef typename detail::class_member_traits<function_type>::class_type class_type;
0104             return (
0105                 BOOST_PROTO_GET_POINTER(class_type, (proto::eval(proto::child_c< 1>( expr), context))) ->*
0106                 proto::eval(proto::child_c< 0>( expr), context)
0107             )(proto::eval(proto::child_c< 2>( expr), context) , proto::eval(proto::child_c< 3>( expr), context) , proto::eval(proto::child_c< 4>( expr), context));
0108         }
0109     };
0110     template<typename Expr, typename Context>
0111     struct default_eval<Expr, Context, proto::tag::function, 6>
0112     {
0113         typedef
0114             typename proto::detail::result_of_fixup<
0115                 typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 0>::type >::type , Context >::type
0116             >::type
0117         function_type;
0118         typedef
0119             typename BOOST_PROTO_RESULT_OF<
0120                 function_type(typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 1>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 2>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 3>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 4>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 5>::type >::type , Context >::type)
0121             >::type
0122         result_type;
0123         result_type operator ()(Expr &expr, Context &context) const
0124         {
0125             return this->invoke(expr, context, is_member_function_pointer<function_type>());
0126         }
0127     private:
0128         result_type invoke(Expr &expr, Context &context, mpl::false_) const
0129         {
0130             return proto::eval(proto::child_c< 0>( expr), context)(
0131                 proto::eval(proto::child_c< 1>( expr), context) , proto::eval(proto::child_c< 2>( expr), context) , proto::eval(proto::child_c< 3>( expr), context) , proto::eval(proto::child_c< 4>( expr), context) , proto::eval(proto::child_c< 5>( expr), context)
0132             );
0133         }
0134         result_type invoke(Expr &expr, Context &context, mpl::true_) const
0135         {
0136             BOOST_PROTO_USE_GET_POINTER();
0137             typedef typename detail::class_member_traits<function_type>::class_type class_type;
0138             return (
0139                 BOOST_PROTO_GET_POINTER(class_type, (proto::eval(proto::child_c< 1>( expr), context))) ->*
0140                 proto::eval(proto::child_c< 0>( expr), context)
0141             )(proto::eval(proto::child_c< 2>( expr), context) , proto::eval(proto::child_c< 3>( expr), context) , proto::eval(proto::child_c< 4>( expr), context) , proto::eval(proto::child_c< 5>( expr), context));
0142         }
0143     };
0144     template<typename Expr, typename Context>
0145     struct default_eval<Expr, Context, proto::tag::function, 7>
0146     {
0147         typedef
0148             typename proto::detail::result_of_fixup<
0149                 typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 0>::type >::type , Context >::type
0150             >::type
0151         function_type;
0152         typedef
0153             typename BOOST_PROTO_RESULT_OF<
0154                 function_type(typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 1>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 2>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 3>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 4>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 5>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 6>::type >::type , Context >::type)
0155             >::type
0156         result_type;
0157         result_type operator ()(Expr &expr, Context &context) const
0158         {
0159             return this->invoke(expr, context, is_member_function_pointer<function_type>());
0160         }
0161     private:
0162         result_type invoke(Expr &expr, Context &context, mpl::false_) const
0163         {
0164             return proto::eval(proto::child_c< 0>( expr), context)(
0165                 proto::eval(proto::child_c< 1>( expr), context) , proto::eval(proto::child_c< 2>( expr), context) , proto::eval(proto::child_c< 3>( expr), context) , proto::eval(proto::child_c< 4>( expr), context) , proto::eval(proto::child_c< 5>( expr), context) , proto::eval(proto::child_c< 6>( expr), context)
0166             );
0167         }
0168         result_type invoke(Expr &expr, Context &context, mpl::true_) const
0169         {
0170             BOOST_PROTO_USE_GET_POINTER();
0171             typedef typename detail::class_member_traits<function_type>::class_type class_type;
0172             return (
0173                 BOOST_PROTO_GET_POINTER(class_type, (proto::eval(proto::child_c< 1>( expr), context))) ->*
0174                 proto::eval(proto::child_c< 0>( expr), context)
0175             )(proto::eval(proto::child_c< 2>( expr), context) , proto::eval(proto::child_c< 3>( expr), context) , proto::eval(proto::child_c< 4>( expr), context) , proto::eval(proto::child_c< 5>( expr), context) , proto::eval(proto::child_c< 6>( expr), context));
0176         }
0177     };
0178     template<typename Expr, typename Context>
0179     struct default_eval<Expr, Context, proto::tag::function, 8>
0180     {
0181         typedef
0182             typename proto::detail::result_of_fixup<
0183                 typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 0>::type >::type , Context >::type
0184             >::type
0185         function_type;
0186         typedef
0187             typename BOOST_PROTO_RESULT_OF<
0188                 function_type(typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 1>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 2>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 3>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 4>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 5>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 6>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 7>::type >::type , Context >::type)
0189             >::type
0190         result_type;
0191         result_type operator ()(Expr &expr, Context &context) const
0192         {
0193             return this->invoke(expr, context, is_member_function_pointer<function_type>());
0194         }
0195     private:
0196         result_type invoke(Expr &expr, Context &context, mpl::false_) const
0197         {
0198             return proto::eval(proto::child_c< 0>( expr), context)(
0199                 proto::eval(proto::child_c< 1>( expr), context) , proto::eval(proto::child_c< 2>( expr), context) , proto::eval(proto::child_c< 3>( expr), context) , proto::eval(proto::child_c< 4>( expr), context) , proto::eval(proto::child_c< 5>( expr), context) , proto::eval(proto::child_c< 6>( expr), context) , proto::eval(proto::child_c< 7>( expr), context)
0200             );
0201         }
0202         result_type invoke(Expr &expr, Context &context, mpl::true_) const
0203         {
0204             BOOST_PROTO_USE_GET_POINTER();
0205             typedef typename detail::class_member_traits<function_type>::class_type class_type;
0206             return (
0207                 BOOST_PROTO_GET_POINTER(class_type, (proto::eval(proto::child_c< 1>( expr), context))) ->*
0208                 proto::eval(proto::child_c< 0>( expr), context)
0209             )(proto::eval(proto::child_c< 2>( expr), context) , proto::eval(proto::child_c< 3>( expr), context) , proto::eval(proto::child_c< 4>( expr), context) , proto::eval(proto::child_c< 5>( expr), context) , proto::eval(proto::child_c< 6>( expr), context) , proto::eval(proto::child_c< 7>( expr), context));
0210         }
0211     };
0212     template<typename Expr, typename Context>
0213     struct default_eval<Expr, Context, proto::tag::function, 9>
0214     {
0215         typedef
0216             typename proto::detail::result_of_fixup<
0217                 typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 0>::type >::type , Context >::type
0218             >::type
0219         function_type;
0220         typedef
0221             typename BOOST_PROTO_RESULT_OF<
0222                 function_type(typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 1>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 2>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 3>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 4>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 5>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 6>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 7>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 8>::type >::type , Context >::type)
0223             >::type
0224         result_type;
0225         result_type operator ()(Expr &expr, Context &context) const
0226         {
0227             return this->invoke(expr, context, is_member_function_pointer<function_type>());
0228         }
0229     private:
0230         result_type invoke(Expr &expr, Context &context, mpl::false_) const
0231         {
0232             return proto::eval(proto::child_c< 0>( expr), context)(
0233                 proto::eval(proto::child_c< 1>( expr), context) , proto::eval(proto::child_c< 2>( expr), context) , proto::eval(proto::child_c< 3>( expr), context) , proto::eval(proto::child_c< 4>( expr), context) , proto::eval(proto::child_c< 5>( expr), context) , proto::eval(proto::child_c< 6>( expr), context) , proto::eval(proto::child_c< 7>( expr), context) , proto::eval(proto::child_c< 8>( expr), context)
0234             );
0235         }
0236         result_type invoke(Expr &expr, Context &context, mpl::true_) const
0237         {
0238             BOOST_PROTO_USE_GET_POINTER();
0239             typedef typename detail::class_member_traits<function_type>::class_type class_type;
0240             return (
0241                 BOOST_PROTO_GET_POINTER(class_type, (proto::eval(proto::child_c< 1>( expr), context))) ->*
0242                 proto::eval(proto::child_c< 0>( expr), context)
0243             )(proto::eval(proto::child_c< 2>( expr), context) , proto::eval(proto::child_c< 3>( expr), context) , proto::eval(proto::child_c< 4>( expr), context) , proto::eval(proto::child_c< 5>( expr), context) , proto::eval(proto::child_c< 6>( expr), context) , proto::eval(proto::child_c< 7>( expr), context) , proto::eval(proto::child_c< 8>( expr), context));
0244         }
0245     };
0246     template<typename Expr, typename Context>
0247     struct default_eval<Expr, Context, proto::tag::function, 10>
0248     {
0249         typedef
0250             typename proto::detail::result_of_fixup<
0251                 typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 0>::type >::type , Context >::type
0252             >::type
0253         function_type;
0254         typedef
0255             typename BOOST_PROTO_RESULT_OF<
0256                 function_type(typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 1>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 2>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 3>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 4>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 5>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 6>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 7>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 8>::type >::type , Context >::type , typename proto::result_of::eval< typename remove_reference< typename proto::result_of::child_c< Expr, 9>::type >::type , Context >::type)
0257             >::type
0258         result_type;
0259         result_type operator ()(Expr &expr, Context &context) const
0260         {
0261             return this->invoke(expr, context, is_member_function_pointer<function_type>());
0262         }
0263     private:
0264         result_type invoke(Expr &expr, Context &context, mpl::false_) const
0265         {
0266             return proto::eval(proto::child_c< 0>( expr), context)(
0267                 proto::eval(proto::child_c< 1>( expr), context) , proto::eval(proto::child_c< 2>( expr), context) , proto::eval(proto::child_c< 3>( expr), context) , proto::eval(proto::child_c< 4>( expr), context) , proto::eval(proto::child_c< 5>( expr), context) , proto::eval(proto::child_c< 6>( expr), context) , proto::eval(proto::child_c< 7>( expr), context) , proto::eval(proto::child_c< 8>( expr), context) , proto::eval(proto::child_c< 9>( expr), context)
0268             );
0269         }
0270         result_type invoke(Expr &expr, Context &context, mpl::true_) const
0271         {
0272             BOOST_PROTO_USE_GET_POINTER();
0273             typedef typename detail::class_member_traits<function_type>::class_type class_type;
0274             return (
0275                 BOOST_PROTO_GET_POINTER(class_type, (proto::eval(proto::child_c< 1>( expr), context))) ->*
0276                 proto::eval(proto::child_c< 0>( expr), context)
0277             )(proto::eval(proto::child_c< 2>( expr), context) , proto::eval(proto::child_c< 3>( expr), context) , proto::eval(proto::child_c< 4>( expr), context) , proto::eval(proto::child_c< 5>( expr), context) , proto::eval(proto::child_c< 6>( expr), context) , proto::eval(proto::child_c< 7>( expr), context) , proto::eval(proto::child_c< 8>( expr), context) , proto::eval(proto::child_c< 9>( expr), context));
0278         }
0279     };