Fix issue with return type in inplace_function
This commit is contained in:
parent
63680cc379
commit
083ce1a150
@ -59,7 +59,7 @@ public:
|
||||
|
||||
return_t operator()(args_t... args) {
|
||||
if (mWrapper)
|
||||
mWrapper(mStorage, args...);
|
||||
return mWrapper(mStorage, args...);
|
||||
else
|
||||
throw std::bad_function_call();
|
||||
}
|
||||
@ -77,7 +77,7 @@ public:
|
||||
requires std::is_invocable_r_v<return_t, decltype(F), args_t...>
|
||||
void bind() {
|
||||
mWrapper = [](storage_t, args_t... args) {
|
||||
std::invoke(F, std::forward<args_t>(args)...);
|
||||
return std::invoke(F, std::forward<args_t>(args)...);
|
||||
};
|
||||
}
|
||||
|
||||
@ -96,8 +96,8 @@ public:
|
||||
new (mStorage)(class_t*){&c};
|
||||
|
||||
mWrapper = [](storage_t storage, args_t... args) {
|
||||
std::invoke(F, reinterpret_cast<class_t*>(storage),
|
||||
std::forward<args_t>(args)...);
|
||||
return std::invoke(F, reinterpret_cast<class_t*>(storage),
|
||||
std::forward<args_t>(args)...);
|
||||
};
|
||||
}
|
||||
|
||||
@ -111,8 +111,8 @@ public:
|
||||
void bind(F f) {
|
||||
new (mStorage) F{std::move(f)};
|
||||
mWrapper = [](storage_t storage, args_t... args) {
|
||||
std::invoke(*reinterpret_cast<F*>(storage),
|
||||
std::forward<args_t>(args)...);
|
||||
return std::invoke(*reinterpret_cast<F*>(storage),
|
||||
std::forward<args_t>(args)...);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user