williamr@2: // Boost Lambda Library - function_adaptors.hpp ---------------------------- williamr@2: williamr@2: // Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi) williamr@2: // williamr@2: // Distributed under the Boost Software License, Version 1.0. (See williamr@2: // accompanying file LICENSE_1_0.txt or copy at williamr@2: // http://www.boost.org/LICENSE_1_0.txt) williamr@2: // williamr@2: // For more information, see www.boost.org williamr@2: williamr@2: williamr@2: #ifndef BOOST_LAMBDA_FUNCTION_ADAPTORS_HPP williamr@2: #define BOOST_LAMBDA_FUNCTION_ADAPTORS_HPP williamr@2: williamr@2: #include "boost/type_traits/same_traits.hpp" williamr@2: williamr@2: namespace boost { williamr@2: namespace lambda { williamr@2: williamr@2: template struct function_adaptor { williamr@2: williamr@2: // we do not know the return type off-hand, we must ask it from Func williamr@2: template class sig { williamr@2: typedef typename Args::head_type F; williamr@2: typedef typename detail::remove_reference_and_cv::type plainF; williamr@2: public: williamr@2: // To sig we pass a cons list, where the head is the function object type williamr@2: // itself (potentially cv-qualified) williamr@2: // and the tail contains the types of the actual arguments to be passed williamr@2: // to the function object. The arguments can be cv qualified williamr@2: // as well. williamr@2: typedef typename plainF::template sig::type type; williamr@2: }; williamr@2: williamr@2: template williamr@2: static RET apply(A1& a1) { williamr@2: return a1(); williamr@2: } williamr@2: template williamr@2: static RET apply(A1& a1, A2& a2) { williamr@2: return a1(a2); williamr@2: } williamr@2: template williamr@2: static RET apply(A1& a1, A2& a2, A3& a3) { williamr@2: return a1(a2, a3); williamr@2: } williamr@2: template williamr@2: static RET apply(A1& a1, A2& a2, A3& a3, A4& a4) { williamr@2: return a1(a2, a3, a4); williamr@2: } williamr@2: template williamr@2: static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) { williamr@2: return a1(a2, a3, a4, a5); williamr@2: } williamr@2: template williamr@2: static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) { williamr@2: return a1(a2, a3, a4, a5, a6); williamr@2: } williamr@2: template williamr@2: static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, williamr@2: A7& a7) { williamr@2: return a1(a2, a3, a4, a5, a6, a7); williamr@2: } williamr@2: template williamr@2: static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, williamr@2: A7& a7, A8& a8) { williamr@2: return a1(a2, a3, a4, a5, a6, a7, a8); williamr@2: } williamr@2: template williamr@2: static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, williamr@2: A7& a7, A8& a8, A9& a9) { williamr@2: return a1(a2, a3, a4, a5, a6, a7, a8, a9); williamr@2: } williamr@2: template williamr@2: static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, williamr@2: A7& a7, A8& a8, A9& a9, A10& a10) { williamr@2: return a1(a2, a3, a4, a5, a6, a7, a8, a9, a10); williamr@2: } williamr@2: }; williamr@2: williamr@2: template struct function_adaptor; // error williamr@2: williamr@2: // -- function adaptors with data member access williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: // typedef detail::unspecified type; williamr@2: williamr@2: // T can have qualifiers and can be a reference type williamr@2: // We get the return type by adding const, if the object through which williamr@2: // the data member is accessed is const, and finally adding a reference williamr@2: template class sig { williamr@2: typedef typename boost::tuples::element<1, Args>::type argument_type; williamr@2: williamr@2: typedef typename detail::IF::value, williamr@2: typename boost::add_const::type, williamr@2: T williamr@2: >::RET properly_consted_return_type; williamr@2: williamr@2: typedef typename detail::IF< williamr@2: boost::is_volatile::value, williamr@2: typename boost::add_volatile::type, williamr@2: properly_consted_return_type williamr@2: >::RET properly_cvd_return_type; williamr@2: williamr@2: williamr@2: public: williamr@2: typedef typename williamr@2: boost::add_reference::type type; williamr@2: }; williamr@2: williamr@2: template williamr@2: static RET apply( T Object::*data, Object& o) { williamr@2: return o.*data; williamr@2: } williamr@2: template williamr@2: static RET apply( T Object::*data, const Object& o) { williamr@2: return o.*data; williamr@2: } williamr@2: template williamr@2: static RET apply( T Object::*data, volatile Object& o) { williamr@2: return o.*data; williamr@2: } williamr@2: template williamr@2: static RET apply( T Object::*data, const volatile Object& o) { williamr@2: return o.*data; williamr@2: } williamr@2: template williamr@2: static RET apply( T Object::*data, Object* o) { williamr@2: return o->*data; williamr@2: } williamr@2: template williamr@2: static RET apply( T Object::*data, const Object* o) { williamr@2: return o->*data; williamr@2: } williamr@2: template williamr@2: static RET apply( T Object::*data, volatile Object* o) { williamr@2: return o->*data; williamr@2: } williamr@2: template williamr@2: static RET apply( T Object::*data, const volatile Object* o) { williamr@2: return o->*data; williamr@2: } williamr@2: }; williamr@2: williamr@2: // -- function adaptors with 1 argument apply williamr@2: williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: static Result apply(Result (*func)()) { williamr@2: return func(); williamr@2: } williamr@2: }; williamr@2: williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: static Result apply(Result (*func)()) { williamr@2: return func(); williamr@2: } williamr@2: }; williamr@2: williamr@2: williamr@2: // -- function adaptors with 2 argument apply williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: static Result apply( Result (Object::*func)() const, const Object* o) { williamr@2: return (o->*func)(); williamr@2: } williamr@2: template williamr@2: static Result apply( Result (Object::*func)() const, const Object& o) { williamr@2: return (o.*func)(); williamr@2: } williamr@2: }; williamr@2: williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: static Result apply( Result (Object::*func)(), Object* o) { williamr@2: return (o->*func)(); williamr@2: } williamr@2: template williamr@2: static Result apply( Result (Object::*func)(), Object& o) { williamr@2: return (o.*func)(); williamr@2: } williamr@2: }; williamr@2: williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: static Result apply(Result (*func)(Arg1), A1& a1) { williamr@2: return func(a1); williamr@2: } williamr@2: }; williamr@2: williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: static Result apply(Result (*func)(Arg1), A1& a1) { williamr@2: return func(a1); williamr@2: } williamr@2: }; williamr@2: williamr@2: williamr@2: // -- function adaptors with 3 argument apply williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: static Result apply( Result (Object::*func)(Arg1) const, const Object* o, williamr@2: A1& a1) { williamr@2: return (o->*func)(a1); williamr@2: } williamr@2: template williamr@2: static Result apply( Result (Object::*func)(Arg1) const, const Object& o, williamr@2: A1& a1) { williamr@2: return (o.*func)(a1); williamr@2: } williamr@2: }; williamr@2: williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: static Result apply( Result (Object::*func)(Arg1), Object* o, A1& a1) { williamr@2: return (o->*func)(a1); williamr@2: } williamr@2: template williamr@2: static Result apply( Result (Object::*func)(Arg1), Object& o, A1& a1) { williamr@2: return (o.*func)(a1); williamr@2: } williamr@2: }; williamr@2: williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: static Result apply(Result (*func)(Arg1, Arg2), A1& a1, A2& a2) { williamr@2: return func(a1, a2); williamr@2: } williamr@2: }; williamr@2: williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: static Result apply(Result (*func)(Arg1, Arg2), A1& a1, A2& a2) { williamr@2: return func(a1, a2); williamr@2: } williamr@2: }; williamr@2: williamr@2: williamr@2: // -- function adaptors with 4 argument apply williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: static Result apply( Result (Object::*func)(Arg1, Arg2) const, const Object* o, A1& a1, A2& a2) { williamr@2: return (o->*func)(a1, a2); williamr@2: } williamr@2: template williamr@2: static Result apply( Result (Object::*func)(Arg1, Arg2) const, const Object& o, A1& a1, A2& a2) { williamr@2: return (o.*func)(a1, a2); williamr@2: } williamr@2: }; williamr@2: williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: static Result apply( Result (Object::*func)(Arg1, Arg2), Object* o, A1& a1, A2& a2) { williamr@2: return (o->*func)(a1, a2); williamr@2: } williamr@2: template williamr@2: static Result apply( Result (Object::*func)(Arg1, Arg2), Object& o, A1& a1, A2& a2) { williamr@2: return (o.*func)(a1, a2); williamr@2: } williamr@2: }; williamr@2: williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: static Result apply(Result (*func)(Arg1, Arg2, Arg3), A1& a1, A2& a2, A3& a3) { williamr@2: return func(a1, a2, a3); williamr@2: } williamr@2: }; williamr@2: williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: static Result apply(Result (*func)(Arg1, Arg2, Arg3), A1& a1, A2& a2, A3& a3) { williamr@2: return func(a1, a2, a3); williamr@2: } williamr@2: }; williamr@2: williamr@2: williamr@2: // -- function adaptors with 5 argument apply williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3) const, const Object* o, A1& a1, A2& a2, A3& a3) { williamr@2: return (o->*func)(a1, a2, a3); williamr@2: } williamr@2: template williamr@2: static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3) const, const Object& o, A1& a1, A2& a2, A3& a3) { williamr@2: return (o.*func)(a1, a2, a3); williamr@2: } williamr@2: }; williamr@2: williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3), Object* o, A1& a1, A2& a2, A3& a3) { williamr@2: return (o->*func)(a1, a2, a3); williamr@2: } williamr@2: template williamr@2: static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3), Object& o, A1& a1, A2& a2, A3& a3) { williamr@2: return (o.*func)(a1, a2, a3); williamr@2: } williamr@2: }; williamr@2: williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4), A1& a1, A2& a2, A3& a3, A4& a4) { williamr@2: return func(a1, a2, a3, a4); williamr@2: } williamr@2: }; williamr@2: williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4), A1& a1, A2& a2, A3& a3, A4& a4) { williamr@2: return func(a1, a2, a3, a4); williamr@2: } williamr@2: }; williamr@2: williamr@2: williamr@2: // -- function adaptors with 6 argument apply williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4) const, const Object* o, A1& a1, A2& a2, A3& a3, A4& a4) { williamr@2: return (o->*func)(a1, a2, a3, a4); williamr@2: } williamr@2: template williamr@2: static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4) const, const Object& o, A1& a1, A2& a2, A3& a3, A4& a4) { williamr@2: return (o.*func)(a1, a2, a3, a4); williamr@2: } williamr@2: }; williamr@2: williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4), Object* o, A1& a1, A2& a2, A3& a3, A4& a4) { williamr@2: return (o->*func)(a1, a2, a3, a4); williamr@2: } williamr@2: template williamr@2: static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4), Object& o, A1& a1, A2& a2, A3& a3, A4& a4) { williamr@2: return (o.*func)(a1, a2, a3, a4); williamr@2: } williamr@2: }; williamr@2: williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) { williamr@2: return func(a1, a2, a3, a4, a5); williamr@2: } williamr@2: }; williamr@2: williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) { williamr@2: return func(a1, a2, a3, a4, a5); williamr@2: } williamr@2: }; williamr@2: williamr@2: williamr@2: // -- function adaptors with 7 argument apply williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: 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) { williamr@2: return (o->*func)(a1, a2, a3, a4, a5); williamr@2: } williamr@2: template williamr@2: 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) { williamr@2: return (o.*func)(a1, a2, a3, a4, a5); williamr@2: } williamr@2: }; williamr@2: williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5), Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) { williamr@2: return (o->*func)(a1, a2, a3, a4, a5); williamr@2: } williamr@2: template williamr@2: static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5), Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) { williamr@2: return (o.*func)(a1, a2, a3, a4, a5); williamr@2: } williamr@2: }; williamr@2: williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) { williamr@2: return func(a1, a2, a3, a4, a5, a6); williamr@2: } williamr@2: }; williamr@2: williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) { williamr@2: return func(a1, a2, a3, a4, a5, a6); williamr@2: } williamr@2: }; williamr@2: williamr@2: williamr@2: // -- function adaptors with 8 argument apply williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: 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) { williamr@2: return (o->*func)(a1, a2, a3, a4, a5, a6); williamr@2: } williamr@2: template williamr@2: 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) { williamr@2: return (o.*func)(a1, a2, a3, a4, a5, a6); williamr@2: } williamr@2: }; williamr@2: williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: 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) { williamr@2: return (o->*func)(a1, a2, a3, a4, a5, a6); williamr@2: } williamr@2: template williamr@2: 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) { williamr@2: return (o.*func)(a1, a2, a3, a4, a5, a6); williamr@2: } williamr@2: }; williamr@2: williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: 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) { williamr@2: return func(a1, a2, a3, a4, a5, a6, a7); williamr@2: } williamr@2: }; williamr@2: williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: 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) { williamr@2: return func(a1, a2, a3, a4, a5, a6, a7); williamr@2: } williamr@2: }; williamr@2: williamr@2: williamr@2: // -- function adaptors with 9 argument apply williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: 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) { williamr@2: return (o->*func)(a1, a2, a3, a4, a5, a6, a7); williamr@2: } williamr@2: template williamr@2: 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) { williamr@2: return (o.*func)(a1, a2, a3, a4, a5, a6, a7); williamr@2: } williamr@2: }; williamr@2: williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: 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) { williamr@2: return (o->*func)(a1, a2, a3, a4, a5, a6, a7); williamr@2: } williamr@2: template williamr@2: 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) { williamr@2: return (o.*func)(a1, a2, a3, a4, a5, a6, a7); williamr@2: } williamr@2: }; williamr@2: williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: 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) { williamr@2: return func(a1, a2, a3, a4, a5, a6, a7, a8); williamr@2: } williamr@2: }; williamr@2: williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: 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) { williamr@2: return func(a1, a2, a3, a4, a5, a6, a7, a8); williamr@2: } williamr@2: }; williamr@2: williamr@2: williamr@2: // -- function adaptors with 10 argument apply williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: 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) { williamr@2: return (o->*func)(a1, a2, a3, a4, a5, a6, a7, a8); williamr@2: } williamr@2: template williamr@2: 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) { williamr@2: return (o.*func)(a1, a2, a3, a4, a5, a6, a7, a8); williamr@2: } williamr@2: }; williamr@2: williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: 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) { williamr@2: return (o->*func)(a1, a2, a3, a4, a5, a6, a7, a8); williamr@2: } williamr@2: template williamr@2: 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) { williamr@2: return (o.*func)(a1, a2, a3, a4, a5, a6, a7, a8); williamr@2: } williamr@2: }; williamr@2: williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: 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) { williamr@2: return func(a1, a2, a3, a4, a5, a6, a7, a8, a9); williamr@2: } williamr@2: }; williamr@2: williamr@2: template williamr@2: struct function_adaptor { williamr@2: williamr@2: template struct sig { typedef Result type; }; williamr@2: template williamr@2: 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) { williamr@2: return func(a1, a2, a3, a4, a5, a6, a7, a8, a9); williamr@2: } williamr@2: }; williamr@2: williamr@2: } // namespace lambda williamr@2: } // namespace boost williamr@2: williamr@2: #endif williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: