Variadic templates can be used here:
template<class F, class O, class... Args>
auto bind(F f, O&& o, Args&&... args)
-> decltype(VoidBind::bind(o, std::function<void()>(std::bind(f, O.get(), args...))))
{
return VoidBind::bind(O, std::function<void()>(std::bind(F, O.get(), args...)));
}
It gets better with C++14 automatic return-type deduction where you don't even need to specify the return value:
template<class F, class O, class... Args>
auto bind(F f, O&& o, Args&&... args)
{
return VoidBind::bind(o, std::function<void()>(std::bind(f, O.get(), args...)));
}