Add constructor for coral::closure that accepts pointers
This commit is contained in:
parent
237c0b4d19
commit
db380e6bae
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue