Add constructor for coral::closure that accepts pointers
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
kayomn 2023-02-23 15:00:32 +00:00
parent 237c0b4d19
commit db380e6bae
1 changed files with 8 additions and 0 deletions

View File

@ -440,6 +440,14 @@ export namespace coral {
this->context = callable_function;
}
template<typename functor> closure(functor * callable_functor) {
this->dispatch = [](void const * context, arguments... dispatch_arguments) -> returns {
return (*reinterpret_cast<functor const*>(context))(dispatch_arguments...);
};
this->context = callable_functor;
}
closure(closure const &) = delete;
template<typename functor> closure(functor && callable_functor) {