util/BindMethod: move SignatureHelper to return type

This commit is contained in:
Max Kellermann 2023-10-02 21:49:39 +02:00 committed by Max Kellermann
parent 7d26cd74c1
commit 5aaa3f50aa
1 changed files with 4 additions and 8 deletions

View File

@ -126,12 +126,10 @@ MakeWrapperFunction() noexcept
* @param instance the instance of #T to be bound
*/
template<auto method>
constexpr auto
constexpr BoundMethod<typename BindMethodDetail::SignatureHelper<decltype(method)>::plain_signature>
BindMethod(typename BindMethodDetail::SignatureHelper<decltype(method)>::class_type &instance) noexcept
{
using H = BindMethodDetail::SignatureHelper<decltype(method)>;
using plain_signature = typename H::plain_signature;
return BoundMethod<plain_signature>{
return {
&instance,
BindMethodDetail::MakeWrapperFunction<method>(),
};
@ -156,12 +154,10 @@ BindMethod(typename BindMethodDetail::SignatureHelper<decltype(method)>::class_t
* @param function the function pointer
*/
template<auto function>
constexpr auto
constexpr BoundMethod<typename BindMethodDetail::SignatureHelper<decltype(function)>::plain_signature>
BindFunction() noexcept
{
using H = BindMethodDetail::SignatureHelper<decltype(function)>;
using plain_signature = typename H::plain_signature;
return BoundMethod<plain_signature>{
return {
nullptr,
BindMethodDetail::MakeWrapperFunction<function>(),
};