7#include "Arp/Base/Core/Detail/DelegateFunctorBase.hxx"
8#include "Arp/Base/Core/Exception.hpp"
10namespace Arp::Base::Core
15template <
typename T>
class LambdaFunctor;
18template<
class R,
class ...A>
19class LambdaFunctor<R(A...)> :
public DelegateFunctorBase<LambdaFunctor<R(A...)>>
22 using Function = std::function<R(A...)>;
25 LambdaFunctor(
const Function& f)
30 LambdaFunctor(Function&& f)
36 template<
class ...Args>
37 static R Invoke(IDelegateFunctor* pFunctor, Args... args)
39 auto* pThis =
dynamic_cast<LambdaFunctor*
>(pFunctor);
40 return std::invoke(pThis->function, args...);
44 bool EqualsTo(
const LambdaFunctor& )
override
46 throw Exception(
String::Format(
"Equality operation is not supported by lambda expressions or std::function."));
static String Format(const String &format, const Args &... args)
Formats the format string using the .NET/Python syntax with the given variadic arguments.
Definition: String.inl:18