Use std::ref to make free functions callable

This commit is contained in:
Jason Turner
2015-05-22 10:28:28 -06:00
parent 630c618ae7
commit 48933bc32c
4 changed files with 20 additions and 13 deletions

View File

@@ -118,8 +118,11 @@ namespace chaiscript
template<typename Ret, typename ... Param>
Proxy_Function fun(Ret (*func)(Param...))
{
auto f_ref = std::ref(*func);
return Proxy_Function(
chaiscript::make_shared<dispatch::Proxy_Function_Base, dispatch::Proxy_Function_Impl<typename dispatch::detail::FunctionSignature<decltype(dispatch::detail::to_function(func)) >::Signature>>(dispatch::detail::to_function(func)));
chaiscript::make_shared<dispatch::Proxy_Function_Base, dispatch::Proxy_Function_Callable_Impl<Ret (Param...), decltype(f_ref)>>(f_ref));
}
template<typename Ret, typename Class, typename ... Param>