From e7458ca10a1fe69077121ab3648ab914a49924de Mon Sep 17 00:00:00 2001 From: Bananymous Date: Tue, 22 Aug 2023 11:30:40 +0300 Subject: [PATCH] BAN: Function call is now const --- BAN/include/BAN/Function.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/BAN/include/BAN/Function.h b/BAN/include/BAN/Function.h index 478f9ee6..0e5f7d5f 100644 --- a/BAN/include/BAN/Function.h +++ b/BAN/include/BAN/Function.h @@ -43,10 +43,10 @@ namespace BAN clear(); } - Ret operator()(Args... args) + Ret operator()(Args... args) const { ASSERT(*this); - return reinterpret_cast(m_storage)->call(forward(args)...); + return reinterpret_cast(m_storage)->call(forward(args)...); } operator bool() const @@ -70,7 +70,7 @@ namespace BAN struct CallableBase { virtual ~CallableBase() {} - virtual Ret call(Args...) = 0; + virtual Ret call(Args...) const = 0; }; struct CallablePointer : public CallableBase @@ -79,7 +79,7 @@ namespace BAN : m_function(function) { } - virtual Ret call(Args... args) override + virtual Ret call(Args... args) const override { return m_function(forward(args)...); } @@ -96,7 +96,7 @@ namespace BAN , m_function(function) { } - virtual Ret call(Args... args) override + virtual Ret call(Args... args) const override { return (m_owner->*m_function)(forward(args)...); } @@ -114,7 +114,7 @@ namespace BAN , m_function(function) { } - virtual Ret call(Args... args) override + virtual Ret call(Args... args) const override { return (m_owner->*m_function)(forward(args)...); } @@ -131,7 +131,7 @@ namespace BAN : m_lambda(lambda) { } - virtual Ret call(Args... args) override + virtual Ret call(Args... args) const override { return m_lambda(forward(args)...); }