Simplify implementation of bind_first and add some detail namespacing

This commit is contained in:
Jason Turner
2009-11-08 14:46:44 +00:00
parent d946cb7e9d
commit 4e5c972e66
4 changed files with 71 additions and 51 deletions

View File

@@ -44,26 +44,30 @@ namespace chaiscript
int expected;
};
template<typename Ret>
struct Do_Call
{
template<typename Fun>
static Boxed_Value go(const boost::function<Fun> &fun, const std::vector<Boxed_Value> &params)
{
return Handle_Return<Ret>::handle(call_func(fun, params));
}
};
namespace detail
{
template<>
struct Do_Call<void>
{
template<typename Fun>
static Boxed_Value go(const boost::function<Fun> &fun, const std::vector<Boxed_Value> &params)
template<typename Ret>
struct Do_Call
{
call_func(fun, params);
return Handle_Return<void>::handle();
template<typename Fun>
static Boxed_Value go(const boost::function<Fun> &fun, const std::vector<Boxed_Value> &params)
{
return Handle_Return<Ret>::handle(call_func(fun, params));
}
};
};
template<>
struct Do_Call<void>
{
template<typename Fun>
static Boxed_Value go(const boost::function<Fun> &fun, const std::vector<Boxed_Value> &params)
{
call_func(fun, params);
return Handle_Return<void>::handle();
};
};
}
}
#define BOOST_PP_ITERATION_LIMITS ( 0, 10 )