Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:39:07

0001 // Boost Lambda Library -  function_adaptors.hpp ----------------------------
0002  
0003 // Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
0004 //
0005 // Distributed under the Boost Software License, Version 1.0. (See
0006 // accompanying file LICENSE_1_0.txt or copy at
0007 // http://www.boost.org/LICENSE_1_0.txt)
0008 //
0009 // For more information, see www.boost.org
0010 
0011 
0012 #ifndef BOOST_LAMBDA_FUNCTION_ADAPTORS_HPP
0013 #define BOOST_LAMBDA_FUNCTION_ADAPTORS_HPP
0014 
0015 #include "boost/mpl/has_xxx.hpp"
0016 #include "boost/tuple/tuple.hpp"
0017 #include "boost/type_traits/same_traits.hpp"
0018 #include "boost/type_traits/remove_reference.hpp"
0019 #include "boost/type_traits/remove_cv.hpp"
0020 #include "boost/type_traits/add_const.hpp"
0021 #include "boost/type_traits/add_volatile.hpp"
0022 #include "boost/utility/result_of.hpp"
0023 
0024 namespace boost { 
0025 namespace lambda {
0026 
0027 namespace detail {
0028 
0029 BOOST_MPL_HAS_XXX_TEMPLATE_DEF(sig)
0030 
0031 template<class Tuple>
0032 struct remove_references_from_elements {
0033   typedef typename boost::tuples::cons<
0034     typename boost::remove_reference<typename Tuple::head_type>::type,
0035     typename remove_references_from_elements<typename Tuple::tail_type>::type
0036   > type;
0037 };
0038 
0039 template<>
0040 struct remove_references_from_elements<boost::tuples::null_type> {
0041   typedef boost::tuples::null_type type;
0042 };
0043 
0044 }
0045 
0046 template <class Func> struct function_adaptor {
0047 
0048   typedef typename detail::remove_reference_and_cv<Func>::type plainF;
0049 
0050 #if !defined(BOOST_NO_RESULT_OF)
0051   // Support functors that use the boost::result_of return type convention.
0052   template<class Tuple, int Length, bool HasSig>
0053   struct result_converter;
0054   template<class Tuple, int Length>
0055   struct result_converter<Tuple, Length, true>
0056     : plainF::template sig<
0057         typename detail::remove_references_from_elements<Tuple>::type
0058       >
0059   {};
0060   template<class Tuple>
0061   struct result_converter<Tuple, 0, false>
0062     : result_of<plainF()>
0063   {};
0064   template<class Tuple>
0065   struct result_converter<Tuple, 1, false>
0066     : result_of<plainF(
0067         typename tuples::element<1, Tuple>::type)
0068       >
0069   {};
0070   template<class Tuple>
0071   struct result_converter<Tuple, 2, false>
0072     : result_of<plainF(
0073         typename tuples::element<1, Tuple>::type,
0074         typename tuples::element<2, Tuple>::type)
0075       >
0076   {};
0077   template<class Tuple>
0078   struct result_converter<Tuple, 3, false>
0079     : result_of<plainF(
0080         typename tuples::element<1, Tuple>::type,
0081         typename tuples::element<2, Tuple>::type,
0082         typename tuples::element<3, Tuple>::type)
0083       >
0084   {};
0085   template<class Tuple>
0086   struct result_converter<Tuple, 4, false>
0087     : result_of<plainF(
0088         typename tuples::element<1, Tuple>::type,
0089         typename tuples::element<2, Tuple>::type,
0090         typename tuples::element<3, Tuple>::type,
0091         typename tuples::element<4, Tuple>::type)
0092       >
0093   {};
0094   template<class Tuple>
0095   struct result_converter<Tuple, 5, false>
0096     : result_of<plainF(
0097         typename tuples::element<1, Tuple>::type,
0098         typename tuples::element<2, Tuple>::type,
0099         typename tuples::element<3, Tuple>::type,
0100         typename tuples::element<4, Tuple>::type,
0101         typename tuples::element<5, Tuple>::type)
0102       >
0103   {};
0104   template<class Tuple>
0105   struct result_converter<Tuple, 6, false>
0106     : result_of<plainF(
0107         typename tuples::element<1, Tuple>::type,
0108         typename tuples::element<2, Tuple>::type,
0109         typename tuples::element<3, Tuple>::type,
0110         typename tuples::element<4, Tuple>::type,
0111         typename tuples::element<5, Tuple>::type,
0112         typename tuples::element<6, Tuple>::type)
0113       >
0114   {};
0115   template<class Tuple>
0116   struct result_converter<Tuple, 7, false>
0117     : result_of<plainF(
0118         typename tuples::element<1, Tuple>::type,
0119         typename tuples::element<2, Tuple>::type,
0120         typename tuples::element<3, Tuple>::type,
0121         typename tuples::element<4, Tuple>::type,
0122         typename tuples::element<5, Tuple>::type,
0123         typename tuples::element<6, Tuple>::type,
0124         typename tuples::element<7, Tuple>::type)
0125       >
0126   {};
0127   template<class Tuple>
0128   struct result_converter<Tuple, 8, false>
0129     : result_of<plainF(
0130         typename tuples::element<1, Tuple>::type,
0131         typename tuples::element<2, Tuple>::type,
0132         typename tuples::element<3, Tuple>::type,
0133         typename tuples::element<4, Tuple>::type,
0134         typename tuples::element<5, Tuple>::type,
0135         typename tuples::element<6, Tuple>::type,
0136         typename tuples::element<7, Tuple>::type,
0137         typename tuples::element<8, Tuple>::type)
0138       >
0139   {};
0140   template<class Tuple>
0141   struct result_converter<Tuple, 9, false>
0142     : result_of<plainF(
0143         typename tuples::element<1, Tuple>::type,
0144         typename tuples::element<2, Tuple>::type,
0145         typename tuples::element<3, Tuple>::type,
0146         typename tuples::element<4, Tuple>::type,
0147         typename tuples::element<5, Tuple>::type,
0148         typename tuples::element<6, Tuple>::type,
0149         typename tuples::element<7, Tuple>::type,
0150         typename tuples::element<8, Tuple>::type,
0151         typename tuples::element<9, Tuple>::type)
0152       >
0153   {};
0154 
0155   // we do not know the return type off-hand, we must ask it from Func
0156   // To sig we pass a cons list, where the head is the function object type
0157   // itself (potentially cv-qualified)
0158   // and the tail contains the types of the actual arguments to be passed
0159   // to the function object. The arguments can be cv qualified
0160   // as well.
0161   template <class Args>
0162   struct sig
0163     : result_converter<
0164         Args
0165       , tuples::length<typename Args::tail_type>::value
0166       , detail::has_sig<plainF>::value
0167       >
0168   {};
0169 #else // BOOST_NO_RESULT_OF
0170 
0171   template <class Args> class sig {
0172     typedef typename detail::remove_reference_and_cv<Func>::type plainF;
0173   public:
0174     typedef typename plainF::template sig<
0175       typename detail::remove_references_from_elements<Args>::type
0176     >::type type;
0177   };
0178 #endif
0179 
0180   template<class RET, class A1>
0181   static RET apply(A1& a1) {
0182     return a1();
0183   }
0184   template<class RET, class A1, class A2>
0185   static RET apply(A1& a1, A2& a2) {
0186     return a1(a2);
0187   }
0188   template<class RET, class A1, class A2, class A3>
0189   static RET apply(A1& a1, A2& a2, A3& a3) {
0190     return a1(a2, a3);
0191   }
0192   template<class RET, class A1, class A2, class A3, class A4>
0193   static RET apply(A1& a1, A2& a2, A3& a3, A4& a4) {
0194     return a1(a2, a3, a4);
0195   }
0196   template<class RET, class A1, class A2, class A3, class A4, class A5>
0197   static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) {
0198     return a1(a2, a3, a4, a5);
0199   }
0200   template<class RET, class A1, class A2, class A3, class A4, class A5, class A6>
0201   static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) {
0202     return a1(a2, a3, a4, a5, a6);
0203   }
0204   template<class RET, class A1, class A2, class A3, class A4, class A5, class A6, 
0205            class A7>
0206   static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, 
0207                            A7& a7) {
0208     return a1(a2, a3, a4, a5, a6, a7);
0209   }
0210   template<class RET, class A1, class A2, class A3, class A4, class A5, class A6, 
0211            class A7, class A8>
0212   static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, 
0213                            A7& a7, A8& a8) {
0214     return a1(a2, a3, a4, a5, a6, a7, a8);
0215   }
0216   template<class RET, class A1, class A2, class A3, class A4, class A5, class A6, 
0217            class A7, class A8, class A9>
0218   static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, 
0219                            A7& a7, A8& a8, A9& a9) {
0220     return a1(a2, a3, a4, a5, a6, a7, a8, a9);
0221   }
0222   template<class RET, class A1, class A2, class A3, class A4, class A5, class A6, 
0223            class A7, class A8, class A9, class A10>
0224   static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, 
0225                            A7& a7, A8& a8, A9& a9, A10& a10) {
0226     return a1(a2, a3, a4, a5, a6, a7, a8, a9, a10);
0227   }
0228 };
0229 
0230 template <class Func> struct function_adaptor<const Func>; // error 
0231 
0232 // -- function adaptors with data member access
0233 template <class Object, class T>
0234 struct function_adaptor<T Object::*> {
0235 
0236   //  typedef detail::unspecified type;
0237 
0238   // T can have qualifiers and can be a reference type
0239   // We get the return type by adding const, if the object through which
0240   // the data member is accessed is const, and finally adding a reference
0241   template<class Args> class sig { 
0242     typedef typename boost::tuples::element<1, Args>::type argument_type;
0243     typedef typename boost::remove_reference<
0244       argument_type
0245     >::type unref_type;
0246 
0247     typedef typename detail::IF<boost::is_const<unref_type>::value,
0248       typename boost::add_const<T>::type,
0249       T
0250     >::RET properly_consted_return_type;
0251 
0252     typedef typename detail::IF<boost::is_volatile<unref_type>::value,
0253       typename boost::add_volatile<properly_consted_return_type>::type,
0254       properly_consted_return_type
0255     >::RET properly_cvd_return_type;
0256 
0257 
0258   public:
0259     typedef typename detail::IF<boost::is_reference<argument_type>::value,
0260       typename boost::add_reference<properly_cvd_return_type>::type,
0261       typename boost::remove_cv<T>::type
0262     >::RET type;
0263   };
0264 
0265   template <class RET>
0266   static RET apply( T Object::*data, Object& o) {
0267     return o.*data;
0268   }
0269   template <class RET>
0270   static RET apply( T Object::*data, const Object& o) {
0271     return o.*data;
0272   }
0273   template <class RET>
0274   static RET apply( T Object::*data, volatile Object& o) {
0275     return o.*data;
0276   }
0277   template <class RET>
0278   static RET apply( T Object::*data, const volatile Object& o) {
0279     return o.*data;
0280   }
0281   template <class RET>
0282   static RET apply( T Object::*data, Object* o) {
0283     return o->*data;
0284   }
0285   template <class RET>
0286   static RET apply( T Object::*data, const Object* o) {
0287     return o->*data;
0288   }
0289   template <class RET>
0290   static RET apply( T Object::*data, volatile Object* o) {
0291     return o->*data;
0292   }
0293   template <class RET>
0294   static RET apply( T Object::*data, const volatile Object* o) {
0295     return o->*data;
0296   }
0297 };
0298 
0299 // -- function adaptors with 1 argument apply
0300    
0301 template <class Result>
0302 struct function_adaptor<Result (void)> {
0303   
0304   template<class T> struct sig { typedef Result type; };
0305   template <class RET>
0306   static Result apply(Result (*func)()) {
0307     return func();
0308   }
0309 };
0310 
0311 template <class Result>
0312 struct function_adaptor<Result (*)(void)> {
0313 
0314   template<class T> struct sig { typedef Result type; };
0315   template <class RET>
0316   static Result apply(Result (*func)()) {
0317     return func();
0318   }
0319 };
0320 
0321 
0322 // -- function adaptors with 2 argument apply
0323 template <class Object, class Result>
0324 struct function_adaptor<Result (Object::*)() const> {
0325 
0326   template<class T> struct sig { typedef Result type; };
0327   template <class RET>
0328   static Result apply( Result (Object::*func)() const, const Object* o) {
0329     return (o->*func)();
0330   }
0331   template <class RET>
0332   static Result apply( Result (Object::*func)() const, const Object& o) {
0333     return (o.*func)();
0334   }
0335 };
0336 
0337 template <class Object, class Result>
0338 struct function_adaptor<Result (Object::*)()> {
0339 
0340   template<class T> struct sig { typedef Result type; };
0341   template <class RET>
0342   static Result apply( Result (Object::*func)(), Object* o) {
0343     return (o->*func)();
0344   }
0345   template <class RET>
0346   static Result apply( Result (Object::*func)(), Object& o) {
0347     return (o.*func)();
0348   }
0349 };
0350 
0351 template <class Arg1, class Result>
0352 struct function_adaptor<Result (Arg1)> {
0353 
0354   template<class T> struct sig { typedef Result type; };
0355   template <class RET, class A1>
0356   static Result apply(Result (*func)(Arg1), A1& a1) {
0357     return func(a1);
0358   }
0359 };
0360 
0361 template <class Arg1, class Result>
0362 struct function_adaptor<Result (*)(Arg1)> {
0363 
0364   template<class T> struct sig { typedef Result type; };
0365   template <class RET, class A1>
0366   static Result apply(Result (*func)(Arg1), A1& a1) {
0367     return func(a1);
0368   }
0369 };
0370 
0371 
0372 // -- function adaptors with 3 argument apply
0373 template <class Object, class Arg1, class Result>
0374 struct function_adaptor<Result (Object::*)(Arg1) const> {
0375 
0376   template<class T> struct sig { typedef Result type; };
0377   template <class RET, class A1>
0378   static Result apply( Result (Object::*func)(Arg1) const, const Object* o, 
0379     A1& a1) {
0380     return (o->*func)(a1);
0381   }
0382   template <class RET, class A1>
0383   static Result apply( Result (Object::*func)(Arg1) const, const Object& o, 
0384     A1& a1) {
0385     return (o.*func)(a1);
0386   }
0387 };
0388 
0389 template <class Object, class Arg1, class Result>
0390 struct function_adaptor<Result (Object::*)(Arg1)> {
0391 
0392   template<class T> struct sig { typedef Result type; };
0393   template <class RET, class A1>
0394   static Result apply( Result (Object::*func)(Arg1), Object* o, A1& a1) {
0395     return (o->*func)(a1);
0396   }
0397   template <class RET, class A1>
0398   static Result apply( Result (Object::*func)(Arg1), Object& o, A1& a1) {
0399     return (o.*func)(a1);
0400   }
0401 };
0402 
0403 template <class Arg1, class Arg2, class Result>
0404 struct function_adaptor<Result (Arg1, Arg2)> {
0405 
0406   template<class T> struct sig { typedef Result type; };
0407   template <class RET, class A1, class A2>
0408   static Result apply(Result (*func)(Arg1, Arg2), A1& a1, A2& a2) {
0409     return func(a1, a2);
0410   }
0411 };
0412 
0413 template <class Arg1, class Arg2, class Result>
0414 struct function_adaptor<Result (*)(Arg1, Arg2)> {
0415 
0416   template<class T> struct sig { typedef Result type; };
0417   template <class RET, class A1, class A2>
0418   static Result apply(Result (*func)(Arg1, Arg2), A1& a1, A2& a2) {
0419     return func(a1, a2);
0420   }
0421 };
0422 
0423 
0424 // -- function adaptors with 4 argument apply
0425 template <class Object, class Arg1, class Arg2, class Result>
0426 struct function_adaptor<Result (Object::*)(Arg1, Arg2) const> {
0427 
0428   template<class T> struct sig { typedef Result type; };
0429   template <class RET, class A1, class A2>
0430   static Result apply( Result (Object::*func)(Arg1, Arg2) const, const Object* o, A1& a1, A2& a2) {
0431     return (o->*func)(a1, a2);
0432   }
0433   template <class RET, class A1, class A2>
0434   static Result apply( Result (Object::*func)(Arg1, Arg2) const, const Object& o, A1& a1, A2& a2) {
0435     return (o.*func)(a1, a2);
0436   }
0437 };
0438 
0439 template <class Object, class Arg1, class Arg2, class Result>
0440 struct function_adaptor<Result (Object::*)(Arg1, Arg2)> {
0441 
0442   template<class T> struct sig { typedef Result type; };
0443   template <class RET, class A1, class A2>
0444   static Result apply( Result (Object::*func)(Arg1, Arg2), Object* o, A1& a1, A2& a2) {
0445     return (o->*func)(a1, a2);
0446   }
0447   template <class RET, class A1, class A2>
0448   static Result apply( Result (Object::*func)(Arg1, Arg2), Object& o, A1& a1, A2& a2) {
0449     return (o.*func)(a1, a2);
0450   }
0451 };
0452 
0453 template <class Arg1, class Arg2, class Arg3, class Result>
0454 struct function_adaptor<Result (Arg1, Arg2, Arg3)> {
0455 
0456   template<class T> struct sig { typedef Result type; };
0457   template <class RET, class A1, class A2, class A3>
0458   static Result apply(Result (*func)(Arg1, Arg2, Arg3), A1& a1, A2& a2, A3& a3) {
0459     return func(a1, a2, a3);
0460   }
0461 };
0462 
0463 template <class Arg1, class Arg2, class Arg3, class Result>
0464 struct function_adaptor<Result (*)(Arg1, Arg2, Arg3)> {
0465 
0466   template<class T> struct sig { typedef Result type; };
0467   template <class RET, class A1, class A2, class A3>
0468   static Result apply(Result (*func)(Arg1, Arg2, Arg3), A1& a1, A2& a2, A3& a3) {
0469     return func(a1, a2, a3);
0470   }
0471 };
0472 
0473 
0474 // -- function adaptors with 5 argument apply
0475 template <class Object, class Arg1, class Arg2, class Arg3, class Result>
0476 struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3) const> {
0477 
0478   template<class T> struct sig { typedef Result type; };
0479   template <class RET, class A1, class A2, class A3>
0480   static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3) const, const Object* o, A1& a1, A2& a2, A3& a3) {
0481     return (o->*func)(a1, a2, a3);
0482   }
0483   template <class RET, class A1, class A2, class A3>
0484   static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3) const, const Object& o, A1& a1, A2& a2, A3& a3) {
0485     return (o.*func)(a1, a2, a3);
0486   }
0487 };
0488 
0489 template <class Object, class Arg1, class Arg2, class Arg3, class Result>
0490 struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3)> {
0491 
0492   template<class T> struct sig { typedef Result type; };
0493   template <class RET, class A1, class A2, class A3>
0494   static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3), Object* o, A1& a1, A2& a2, A3& a3) {
0495     return (o->*func)(a1, a2, a3);
0496   }
0497   template <class RET, class A1, class A2, class A3>
0498   static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3), Object& o, A1& a1, A2& a2, A3& a3) {
0499     return (o.*func)(a1, a2, a3);
0500   }
0501 };
0502 
0503 template <class Arg1, class Arg2, class Arg3, class Arg4, class Result>
0504 struct function_adaptor<Result (Arg1, Arg2, Arg3, Arg4)> {
0505 
0506   template<class T> struct sig { typedef Result type; };
0507   template <class RET, class A1, class A2, class A3, class A4>
0508   static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4), A1& a1, A2& a2, A3& a3, A4& a4) {
0509     return func(a1, a2, a3, a4);
0510   }
0511 };
0512 
0513 template <class Arg1, class Arg2, class Arg3, class Arg4, class Result>
0514 struct function_adaptor<Result (*)(Arg1, Arg2, Arg3, Arg4)> {
0515 
0516   template<class T> struct sig { typedef Result type; };
0517   template <class RET, class A1, class A2, class A3, class A4>
0518   static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4), A1& a1, A2& a2, A3& a3, A4& a4) {
0519     return func(a1, a2, a3, a4);
0520   }
0521 };
0522 
0523 
0524 // -- function adaptors with 6 argument apply
0525 template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Result>
0526 struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4) const> {
0527 
0528   template<class T> struct sig { typedef Result type; };
0529   template <class RET, class A1, class A2, class A3, class A4>
0530   static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4) const, const Object* o, A1& a1, A2& a2, A3& a3, A4& a4) {
0531     return (o->*func)(a1, a2, a3, a4);
0532   }
0533   template <class RET, class A1, class A2, class A3, class A4>
0534   static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4) const, const Object& o, A1& a1, A2& a2, A3& a3, A4& a4) {
0535     return (o.*func)(a1, a2, a3, a4);
0536   }
0537 };
0538 
0539 template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Result>
0540 struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4)> {
0541 
0542   template<class T> struct sig { typedef Result type; };
0543   template <class RET, class A1, class A2, class A3, class A4>
0544   static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4), Object* o, A1& a1, A2& a2, A3& a3, A4& a4) {
0545     return (o->*func)(a1, a2, a3, a4);
0546   }
0547   template <class RET, class A1, class A2, class A3, class A4>
0548   static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4), Object& o, A1& a1, A2& a2, A3& a3, A4& a4) {
0549     return (o.*func)(a1, a2, a3, a4);
0550   }
0551 };
0552 
0553 template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Result>
0554 struct function_adaptor<Result (Arg1, Arg2, Arg3, Arg4, Arg5)> {
0555 
0556   template<class T> struct sig { typedef Result type; };
0557   template <class RET, class A1, class A2, class A3, class A4, class A5>
0558   static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) {
0559     return func(a1, a2, a3, a4, a5);
0560   }
0561 };
0562 
0563 template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Result>
0564 struct function_adaptor<Result (*)(Arg1, Arg2, Arg3, Arg4, Arg5)> {
0565 
0566   template<class T> struct sig { typedef Result type; };
0567   template <class RET, class A1, class A2, class A3, class A4, class A5>
0568   static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) {
0569     return func(a1, a2, a3, a4, a5);
0570   }
0571 };
0572 
0573 
0574 // -- function adaptors with 7 argument apply
0575 template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Result>
0576 struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5) const> {
0577 
0578   template<class T> struct sig { typedef Result type; };
0579   template <class RET, class A1, class A2, class A3, class A4, class A5>
0580   static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5) const, const Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) {
0581     return (o->*func)(a1, a2, a3, a4, a5);
0582   }
0583   template <class RET, class A1, class A2, class A3, class A4, class A5>
0584   static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5) const, const Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) {
0585     return (o.*func)(a1, a2, a3, a4, a5);
0586   }
0587 };
0588 
0589 template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Result>
0590 struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5)> {
0591 
0592   template<class T> struct sig { typedef Result type; };
0593   template <class RET, class A1, class A2, class A3, class A4, class A5>
0594   static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5), Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) {
0595     return (o->*func)(a1, a2, a3, a4, a5);
0596   }
0597   template <class RET, class A1, class A2, class A3, class A4, class A5>
0598   static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5), Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) {
0599     return (o.*func)(a1, a2, a3, a4, a5);
0600   }
0601 };
0602 
0603 template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Result>
0604 struct function_adaptor<Result (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)> {
0605 
0606   template<class T> struct sig { typedef Result type; };
0607   template <class RET, class A1, class A2, class A3, class A4, class A5, class A6>
0608   static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) {
0609     return func(a1, a2, a3, a4, a5, a6);
0610   }
0611 };
0612 
0613 template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Result>
0614 struct function_adaptor<Result (*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)> {
0615 
0616   template<class T> struct sig { typedef Result type; };
0617   template <class RET, class A1, class A2, class A3, class A4, class A5, class A6>
0618   static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) {
0619     return func(a1, a2, a3, a4, a5, a6);
0620   }
0621 };
0622 
0623 
0624 // -- function adaptors with 8 argument apply
0625 template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Result>
0626 struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) const> {
0627 
0628   template<class T> struct sig { typedef Result type; };
0629   template <class RET, class A1, class A2, class A3, class A4, class A5, class A6>
0630   static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) const, const Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) {
0631     return (o->*func)(a1, a2, a3, a4, a5, a6);
0632   }
0633   template <class RET, class A1, class A2, class A3, class A4, class A5, class A6>
0634   static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) const, const Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) {
0635     return (o.*func)(a1, a2, a3, a4, a5, a6);
0636   }
0637 };
0638 
0639 template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Result>
0640 struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)> {
0641 
0642   template<class T> struct sig { typedef Result type; };
0643   template <class RET, class A1, class A2, class A3, class A4, class A5, class A6>
0644   static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6), Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) {
0645     return (o->*func)(a1, a2, a3, a4, a5, a6);
0646   }
0647   template <class RET, class A1, class A2, class A3, class A4, class A5, class A6>
0648   static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6), Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) {
0649     return (o.*func)(a1, a2, a3, a4, a5, a6);
0650   }
0651 };
0652 
0653 template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Result>
0654 struct function_adaptor<Result (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)> {
0655 
0656   template<class T> struct sig { typedef Result type; };
0657   template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
0658   static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) {
0659     return func(a1, a2, a3, a4, a5, a6, a7);
0660   }
0661 };
0662 
0663 template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Result>
0664 struct function_adaptor<Result (*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)> {
0665 
0666   template<class T> struct sig { typedef Result type; };
0667   template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
0668   static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) {
0669     return func(a1, a2, a3, a4, a5, a6, a7);
0670   }
0671 };
0672 
0673 
0674 // -- function adaptors with 9 argument apply
0675 template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Result>
0676 struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7) const> {
0677 
0678   template<class T> struct sig { typedef Result type; };
0679   template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
0680   static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7) const, const Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) {
0681     return (o->*func)(a1, a2, a3, a4, a5, a6, a7);
0682   }
0683   template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
0684   static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7) const, const Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) {
0685     return (o.*func)(a1, a2, a3, a4, a5, a6, a7);
0686   }
0687 };
0688 
0689 template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Result>
0690 struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)> {
0691 
0692   template<class T> struct sig { typedef Result type; };
0693   template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
0694   static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7), Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) {
0695     return (o->*func)(a1, a2, a3, a4, a5, a6, a7);
0696   }
0697   template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
0698   static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7), Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) {
0699     return (o.*func)(a1, a2, a3, a4, a5, a6, a7);
0700   }
0701 };
0702 
0703 template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Result>
0704 struct function_adaptor<Result (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8)> {
0705 
0706   template<class T> struct sig { typedef Result type; };
0707   template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
0708   static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) {
0709     return func(a1, a2, a3, a4, a5, a6, a7, a8);
0710   }
0711 };
0712 
0713 template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Result>
0714 struct function_adaptor<Result (*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8)> {
0715 
0716   template<class T> struct sig { typedef Result type; };
0717   template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
0718   static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) {
0719     return func(a1, a2, a3, a4, a5, a6, a7, a8);
0720   }
0721 };
0722 
0723 
0724 // -- function adaptors with 10 argument apply
0725 template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Result>
0726 struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8) const> {
0727 
0728   template<class T> struct sig { typedef Result type; };
0729   template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
0730   static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8) const, const Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) {
0731     return (o->*func)(a1, a2, a3, a4, a5, a6, a7, a8);
0732   }
0733   template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
0734   static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8) const, const Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) {
0735     return (o.*func)(a1, a2, a3, a4, a5, a6, a7, a8);
0736   }
0737 };
0738 
0739 template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Result>
0740 struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8)> {
0741 
0742   template<class T> struct sig { typedef Result type; };
0743   template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
0744   static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8), Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) {
0745     return (o->*func)(a1, a2, a3, a4, a5, a6, a7, a8);
0746   }
0747   template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
0748   static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8), Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) {
0749     return (o.*func)(a1, a2, a3, a4, a5, a6, a7, a8);
0750   }
0751 };
0752 
0753 template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Arg9, class Result>
0754 struct function_adaptor<Result (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9)> {
0755 
0756   template<class T> struct sig { typedef Result type; };
0757   template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
0758   static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8, A9& a9) {
0759     return func(a1, a2, a3, a4, a5, a6, a7, a8, a9);
0760   }
0761 };
0762 
0763 template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Arg9, class Result>
0764 struct function_adaptor<Result (*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9)> {
0765 
0766   template<class T> struct sig { typedef Result type; };
0767   template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
0768   static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8, A9& a9) {
0769     return func(a1, a2, a3, a4, a5, a6, a7, a8, a9);
0770   }
0771 };
0772 
0773 } // namespace lambda
0774 } // namespace boost
0775 
0776 #endif
0777 
0778 
0779 
0780 
0781 
0782 
0783 
0784 
0785 
0786 
0787 
0788 
0789