Replace coral::callable with coral::closure #9

Merged
kayomn merged 2 commits from replace-callable into main 2023-02-23 16:12:30 +01:00
1 changed files with 8 additions and 0 deletions
Showing only changes of commit db380e6bae - Show all commits

View File

@ -440,6 +440,14 @@ export namespace coral {
this->context = callable_function; 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; closure(closure const &) = delete;
template<typename functor> closure(functor && callable_functor) { template<typename functor> closure(functor && callable_functor) {