diff --git a/include/chaiscript/dispatchkit/register_function.hpp b/include/chaiscript/dispatchkit/register_function.hpp index 9fd7e31..1871315 100644 --- a/include/chaiscript/dispatchkit/register_function.hpp +++ b/include/chaiscript/dispatchkit/register_function.hpp @@ -16,19 +16,6 @@ namespace chaiscript { - template - Proxy_Function fun(T t) - { - return fun_helper(t); - } - - template - Proxy_Function fun_helper(const boost::function &f) - { - return Proxy_Function(new Proxy_Function_Impl(f)); - } - - namespace detail { /** @@ -39,57 +26,76 @@ namespace chaiscript { return (obj->*m); } + + template + Proxy_Function fun_helper(const boost::function &f) + { + return Proxy_Function(new Proxy_Function_Impl(f)); + } + + /** + * Automatically create a get_member helper function for an object + * to allow for runtime dispatched access to public data members + * for example, the case of std::pair<>::first and std::pair<>::second + */ + template + Proxy_Function fun_helper(T Class::* m) + { + return fun_helper(boost::function(boost::bind(&detail::get_member, m, _1))); + } } - - /** - * Automatically create a get_member helper function for an object - * to allow for runtime dispatched access to public data members - * for example, the case of std::pair<>::first and std::pair<>::second - */ - template - Proxy_Function fun_helper(T Class::* m) - { - return fun_helper(boost::function(boost::bind(&detail::get_member, m, _1))); - } - } #define BOOST_PP_ITERATION_LIMITS ( 0, 10 ) #define BOOST_PP_FILENAME_1 #include BOOST_PP_ITERATE() +namespace chaiscript +{ + template + Proxy_Function fun(T t) + { + return detail::fun_helper(t); + } +} + + # endif #else # define n BOOST_PP_ITERATION() namespace chaiscript { - /** - * Register a global function of n parameters with name - */ - template - Proxy_Function fun_helper(Ret (*f)(BOOST_PP_ENUM_PARAMS(n, Param))) - { - return fun_helper(boost::function(f)); - } + namespace detail + { + /** + * Register a global function of n parameters with name + */ + template + Proxy_Function fun_helper(Ret (*f)(BOOST_PP_ENUM_PARAMS(n, Param))) + { + return fun_helper(boost::function(f)); + } - /** - * Register a class method of n parameters with name - */ - template - Proxy_Function fun_helper(Ret (Class::*f)(BOOST_PP_ENUM_PARAMS(n, Param))) - { - return fun_helper(boost::function(f)); - } + /** + * Register a class method of n parameters with name + */ + template + Proxy_Function fun_helper(Ret (Class::*f)(BOOST_PP_ENUM_PARAMS(n, Param))) + { + return fun_helper(boost::function(f)); + } - /** - * Register a const class method of n parameters with name - */ - template - Proxy_Function fun_helper(Ret (Class::*f)(BOOST_PP_ENUM_PARAMS(n, Param))const) - { - return fun_helper(boost::function(f)); - } + /** + * Register a const class method of n parameters with name + */ + template + Proxy_Function fun_helper(Ret (Class::*f)(BOOST_PP_ENUM_PARAMS(n, Param))const) + { + return fun_helper(boost::function(f)); + } + + } } #endif