diff --git a/Source/Engine/Core/Delegate.h b/Source/Engine/Core/Delegate.h
index bba43eb16..9269fec9d 100644
--- a/Source/Engine/Core/Delegate.h
+++ b/Source/Engine/Core/Delegate.h
@@ -89,6 +89,20 @@ public:
_lambda = nullptr;
}
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ template
+ Function(const T& lambda)
+ {
+ _lambda = (Lambda*)Allocator::Allocate(sizeof(Lambda) + sizeof(T));
+ _lambda->Refs = 1;
+ _lambda->Dtor = [](void* callee) -> void { static_cast(callee)->~T(); };
+ _function = [](void* callee, Params ... params) -> ReturnType { return (*static_cast(callee))(Forward(params)...); };
+ _callee = (byte*)_lambda + sizeof(Lambda);
+ new(_callee) T(lambda);
+ }
+
Function(const Function& other)
: _callee(other._callee)
, _function(other._function)