From db380e6baecabcf136882c3b9ee80b3d0c087ee9 Mon Sep 17 00:00:00 2001 From: kayomn Date: Thu, 23 Feb 2023 15:00:32 +0000 Subject: [PATCH] Add constructor for coral::closure that accepts pointers --- source/coral.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/coral.cpp b/source/coral.cpp index 7839d95..5c70cc0 100644 --- a/source/coral.cpp +++ b/source/coral.cpp @@ -440,6 +440,14 @@ export namespace coral { this->context = callable_function; } + template closure(functor * callable_functor) { + this->dispatch = [](void const * context, arguments... dispatch_arguments) -> returns { + return (*reinterpret_cast(context))(dispatch_arguments...); + }; + + this->context = callable_functor; + } + closure(closure const &) = delete; template closure(functor && callable_functor) {