util/BindMethod: merge MakeBind{Method,Function}Wrapper(), they are identical now

This commit is contained in:
Max Kellermann 2021-12-03 08:17:32 +01:00 committed by Max Kellermann
parent 687327c9e8
commit 047e169f3e

View File

@ -140,18 +140,11 @@ struct WrapperGenerator<R (*)(Args...) noexcept(NoExcept), function> {
template<auto method> template<auto method>
typename SignatureHelper<decltype(method)>::function_pointer typename SignatureHelper<decltype(method)>::function_pointer
MakeBindMethodWrapper() noexcept MakeWrapperFunction() noexcept
{ {
return WrapperGenerator<decltype(method), method>::Invoke; return WrapperGenerator<decltype(method), method>::Invoke;
} }
template<auto function>
typename SignatureHelper<decltype(function)>::function_pointer
MakeBindFunctionWrapper() noexcept
{
return WrapperGenerator<decltype(function), function>::Invoke;
}
} /* namespace BindMethodDetail */ } /* namespace BindMethodDetail */
/** /**
@ -168,7 +161,7 @@ BindMethod(typename BindMethodDetail::SignatureHelper<decltype(method)>::class_t
using plain_signature = typename H::plain_signature; using plain_signature = typename H::plain_signature;
return BoundMethod<plain_signature>{ return BoundMethod<plain_signature>{
&instance, &instance,
BindMethodDetail::MakeBindMethodWrapper<method>(), BindMethodDetail::MakeWrapperFunction<method>(),
}; };
} }
@ -198,7 +191,7 @@ BindFunction() noexcept
using plain_signature = typename H::plain_signature; using plain_signature = typename H::plain_signature;
return BoundMethod<plain_signature>{ return BoundMethod<plain_signature>{
nullptr, nullptr,
BindMethodDetail::MakeBindFunctionWrapper<function>(), BindMethodDetail::MakeWrapperFunction<function>(),
}; };
} }