changing signature of a function
kotbegemot opened this issue · comments
Alexandr commented
template<
class Actor,
class Inserter,
class... Args,
class = type_traits::enable_if_t<std::is_base_of<actor_abstract, Actor>::value>>
auto spawn_actor(const Inserter& inserter, Args&&... args) -> address_t {
auto allocate_byte = sizeof(Actor);
auto allocate_byte_alignof = alignof(Actor);
void* buffer = resource()->allocate(allocate_byte, allocate_byte_alignof);
auto* actor = new (buffer) Actor(static_cast<Supervisor*>(this), std::forward<Args>(args)...);
auto address = actor->address();
inserter(actor);
return address;
}
template<
class Inserter,
class... Args,
class = type_traits::enable_if_t<std::is_base_of<actor_abstract, Actor>::value>>
auto spawn_actor(const Inserter& inserter, Args&&... args) -> address_t {
using call_trait = type_traits::get_callable_trait_t<type_traits::remove_reference_t<F>>;
using Actor = type_traits::tl_slice_t<typename call_trait::args_types, 0, args_size>;
auto allocate_byte = sizeof(Actor);
auto allocate_byte_alignof = alignof(Actor);
void* buffer = resource()->allocate(allocate_byte, allocate_byte_alignof);
auto* actor = new (buffer) Actor(static_cast<Supervisor*>(this), std::forward<Args>(args)...);
auto address = actor->address();
inserter(actor);
return address;
}