mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-02-20 07:13:49 -07:00
Common: Make a void-returning MoveOnlyFunction able to accept a non-void-returning function object and just drop the return value. std::function behaves this way.
This commit is contained in:
parent
44c7440702
commit
cf3d5509b1
@ -45,7 +45,13 @@ private:
|
||||
struct Func : FuncBase
|
||||
{
|
||||
explicit Func(F&& f) : func{std::forward<F>(f)} {}
|
||||
result_type Invoke(Args... args) override { return func(std::forward<Args>(args)...); }
|
||||
result_type Invoke(Args... args) override
|
||||
{
|
||||
if constexpr (std::is_void_v<result_type>)
|
||||
func(std::forward<Args>(args)...);
|
||||
else
|
||||
return func(std::forward<Args>(args)...);
|
||||
}
|
||||
std::decay_t<F> func;
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user