// This file is distributed under the BSD License. // See "license.txt" for details. // Copyright 2009, Jonathan Turner (jturner@minnow-lang.org) // and Jason Turner (lefticus@gmail.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 #include #include #include #include #define BOOST_PP_ITERATION_LIMITS ( 0, 8 ) #define BOOST_PP_FILENAME_1 namespace chaiscript { namespace detail { template struct bind_helper { template static boost::function go(const F &f, const V &v) { return boost::function(); } }; #include BOOST_PP_ITERATE() template struct pop_front { typedef typename boost::function_types::function_type< typename boost::mpl::push_front< typename boost::mpl::pop_front >::type, typename boost::function_types::result_type::type >::type >::type type; }; template boost::function::type> bind_first(T t, const U &u) { return bind_helper::value, typename pop_front::type>::go(t, u); } } } # endif #else # define n BOOST_PP_ITERATION() # define m BOOST_PP_INC(n) template struct bind_helper { template static boost::function go(const F &f, const V &v) { return boost::bind(f, v BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM(n, param, _)); } }; #endif