Replace template operator() of util::function with a fixed-arg version to put all implicit conversions & list initializations to the actual call site
This commit is contained in:
parent
4dc8b6a183
commit
42260d4d7d
1 changed files with 3 additions and 5 deletions
|
|
@ -74,8 +74,7 @@ namespace psemek::util
|
||||||
return static_cast<bool>(vtable_);
|
return static_cast<bool>(vtable_);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ... Args1>
|
R operator()(Args ... args) const;
|
||||||
R operator()(Args1 && ... args) const;
|
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
|
@ -168,13 +167,12 @@ namespace psemek::util
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename R, typename ... Args>
|
template <typename R, typename ... Args>
|
||||||
template <typename ... Args1>
|
R function<R(Args...)>::operator()(Args ... args) const
|
||||||
R function<R(Args...)>::operator()(Args1 && ... args) const
|
|
||||||
{
|
{
|
||||||
if (!vtable_)
|
if (!vtable_)
|
||||||
throw empty_function_error{};
|
throw empty_function_error{};
|
||||||
|
|
||||||
return vtable_->call(const_cast<void *>(static_cast<void const *>(&storage_)), std::forward<Args1>(args)...);
|
return vtable_->call(const_cast<void *>(static_cast<void const *>(&storage_)), std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename R, typename ... Args>
|
template <typename R, typename ... Args>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue