// This file is distributed under the BSD License. // See "license.txt" for details. // Copyright 2009-2010, Jonathan Turner (jonathan@emptycrate.com) // and Jason Turner (jason@emptycrate.com) // http://www.chaiscript.com #include #include #define param(z,n,text) BOOST_PP_CAT(text, BOOST_PP_INC(n)) #ifndef BOOST_PP_IS_ITERATING #ifndef __bind_first_hpp__ #define __bind_first_hpp__ #include #include #include #define BOOST_PP_ITERATION_LIMITS ( 0, 8 ) #define BOOST_PP_FILENAME_1 #include BOOST_PP_ITERATE() # endif #else # define n BOOST_PP_ITERATION() # define m BOOST_PP_INC(n) namespace chaiscript { namespace detail { template boost::function bind_first(Ret (Class::*f)(BOOST_PP_ENUM_PARAMS(n, Param)), const O &o) { return boost::bind(boost::mem_fn(f), o BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM(n, param, _)); } template boost::function bind_first(Ret (Class::*f)(BOOST_PP_ENUM_PARAMS(n, Param))const, const O &o) { return boost::bind(boost::mem_fn(f), o BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM(n, param, _)); } template boost::function bind_first(Ret (*f)(BOOST_PP_ENUM_PARAMS(m, Param)), const O &o) { return boost::bind(f, o BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM(n, param, _)); } template boost::function bind_first(const boost::function &f, const O &o) { return boost::bind(f, o BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM(n, param, _)); } } } #undef n #undef m #endif