Add <functional> include in util::function for std::invoke
This commit is contained in:
parent
75b847ec23
commit
1e1679ffe0
1 changed files with 2 additions and 9 deletions
|
|
@ -2,18 +2,11 @@
|
||||||
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
namespace psemek::util
|
namespace psemek::util
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace detail
|
|
||||||
{
|
|
||||||
|
|
||||||
// Implemented in cpp to prevent dependency on <functional>
|
|
||||||
[[noreturn]] void bad_function_call();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Signature>
|
template <typename Signature>
|
||||||
struct function;
|
struct function;
|
||||||
|
|
||||||
|
|
@ -154,7 +147,7 @@ namespace psemek::util
|
||||||
R function<R(Args...)>::operator()(Args1 && ... args) const
|
R function<R(Args...)>::operator()(Args1 && ... args) const
|
||||||
{
|
{
|
||||||
if (!vtable_)
|
if (!vtable_)
|
||||||
detail::bad_function_call();
|
throw std::bad_function_call();
|
||||||
|
|
||||||
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<Args1>(args)...);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue