Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 30 additions & 18 deletions include/prim/seadDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,9 @@ class LambdaDelegate : public IDelegate
{
public:
explicit LambdaDelegate(Lambda l) : mLambda(std::move(l)) {}
auto invoke() override { return mLambda(); }
auto operator()() const { return mLambda(); }
auto clone(Heap* heap) const override { return new (heap) LambdaDelegate(*this); }
void invoke() override { mLambda(); }
void operator()() const { mLambda(); }
LambdaDelegate* clone(Heap* heap) const override { return new (heap) LambdaDelegate(*this); }

protected:
Lambda mLambda;
Expand All @@ -371,9 +371,9 @@ class LambdaDelegateR : public IDelegateR<R>
{
public:
explicit LambdaDelegateR(Lambda l) : mLambda(std::move(l)) {}
auto invoke() override { return mLambda(); }
auto operator()() const { return mLambda(); }
auto clone(Heap* heap) const override { return new (heap) LambdaDelegateR(*this); }
R invoke() override { return mLambda(); }
R operator()() const { return mLambda(); }
LambdaDelegateR* clone(Heap* heap) const override { return new (heap) LambdaDelegateR(*this); }

protected:
Lambda mLambda;
Expand All @@ -384,9 +384,9 @@ class LambdaDelegate1 : public IDelegate1<A1>
{
public:
explicit LambdaDelegate1(Lambda l) : mLambda(std::move(l)) {}
auto invoke(A1 a1) override { return mLambda(a1); }
auto operator()(A1 a1) const { return mLambda(a1); }
auto clone(Heap* heap) const override { return new (heap) LambdaDelegate1(*this); }
void invoke(A1 a1) override { mLambda(a1); }
void operator()(A1 a1) const { mLambda(a1); }
LambdaDelegate1* clone(Heap* heap) const override { return new (heap) LambdaDelegate1(*this); }

protected:
Lambda mLambda;
Expand All @@ -397,9 +397,12 @@ class LambdaDelegate1R : public IDelegate1R<A1, R>
{
public:
explicit LambdaDelegate1R(Lambda l) : mLambda(std::move(l)) {}
auto invoke(A1 a1) override { return mLambda(a1); }
auto operator()(A1 a1) const { return mLambda(a1); }
auto clone(Heap* heap) const override { return new (heap) LambdaDelegate1R(*this); }
R invoke(A1 a1) override { return mLambda(a1); }
R operator()(A1 a1) const { return mLambda(a1); }
LambdaDelegate1R* clone(Heap* heap) const override
{
return new (heap) LambdaDelegate1R(*this);
}

protected:
Lambda mLambda;
Expand All @@ -410,9 +413,9 @@ class LambdaDelegate2 : public IDelegate2<A1, A2>
{
public:
explicit LambdaDelegate2(Lambda l) : mLambda(std::move(l)) {}
auto invoke(A1 a1, A2 a2) override { return mLambda(a1, a2); }
auto operator()(A1 a1, A2 a2) const { return mLambda(a1, a2); }
auto clone(Heap* heap) const override { return new (heap) LambdaDelegate2(*this); }
void invoke(A1 a1, A2 a2) override { mLambda(a1, a2); }
void operator()(A1 a1, A2 a2) const { mLambda(a1, a2); }
LambdaDelegate2* clone(Heap* heap) const override { return new (heap) LambdaDelegate2(*this); }

protected:
Lambda mLambda;
Expand All @@ -423,9 +426,12 @@ class LambdaDelegate2R : public IDelegate2R<A1, A2, R>
{
public:
explicit LambdaDelegate2R(Lambda l) : mLambda(std::move(l)) {}
auto invoke(A1 a1, A2 a2) override { return mLambda(a1, a2); }
auto operator()(A1 a1, A2 a2) const { return mLambda(a1, a2); }
auto clone(Heap* heap) const override { return new (heap) LambdaDelegate2R(*this); }
R invoke(A1 a1, A2 a2) override { return mLambda(a1, a2); }
R operator()(A1 a1, A2 a2) const { return mLambda(a1, a2); }
LambdaDelegate2R* clone(Heap* heap) const override
{
return new (heap) LambdaDelegate2R(*this);
}

protected:
Lambda mLambda;
Expand Down Expand Up @@ -574,11 +580,17 @@ class AnyDelegateR
class UnbindDummy final : public Base::Interface_
{
public:
UnbindDummy() {}
R invoke() override { return {}; }
#if SEAD_DELEGATE_ISNODUMMY
bool isNoDummy() const override { return false; }
#endif
private:
s32 mUnk = 1;
};

AnyDelegateR() {}

using Base::Base;
using Base::operator=;
};
Expand Down
Loading