@@ -440,45 +440,35 @@ object_t* make_instance(actor_ref context,
440
440
441
441
}// namespace core
442
442
443
- namespace detail {
444
-
445
- template <typename Impl>
446
- inline core::object_t *make_instance (actor_ref context,
447
- const actor_thread thread_opt,
448
- std::unique_ptr<Impl> impl) {
449
- static_assert (std::is_base_of<::acto::actor, Impl>::value,
450
- " implementation should be derived from the acto::actor class" );
451
-
452
- return core::make_instance (std::move (context), thread_opt,std::move (impl));
453
- }
454
-
455
- }// namespace detail
456
-
457
443
template <typename T,typename ... P>
458
- inline actor_refspawn (P&&... p) {
459
- return actor_ref (detail::make_instance<T>(actor_ref (), actor_thread::shared,
444
+ inline std::enable_if_t <std::is_base_of<::acto::actor, T>::value, actor_ref>
445
+ spawn (P&&... p) {
446
+ return actor_ref (core::make_instance (actor_ref (), actor_thread::shared,
460
447
std::make_unique<T>(std::forward<P>(p)...)),
461
448
false );
462
449
}
463
450
464
- template <typename T>
465
- inline actor_refspawn (actor_ref context) {
466
- return actor_ref (detail::make_instance<T>(std::move (context),
467
- actor_thread::shared, std::make_unique<T>()),
451
+ template <typename T,typename ... P>
452
+ inline std::enable_if_t <std::is_base_of<::acto::actor, T>::value, actor_ref>
453
+ spawn (actor_ref context, P&&... p) {
454
+ return actor_ref (core::make_instance (std::move (context), actor_thread::shared,
455
+ std::make_unique<T>(std::forward<P>(p)...)),
468
456
false );
469
457
}
470
458
471
- template <typename T>
472
- inline actor_refspawn (const actor_thread thread_opt) {
473
- return actor_ref (
474
- detail::make_instance<T>(actor_ref (), thread_opt, std::make_unique<T>()),
459
+ template <typename T,typename ... P>
460
+ inline std::enable_if_t <std::is_base_of<::acto::actor, T>::value, actor_ref>
461
+ spawn (const actor_thread thread_opt, P&&... p) {
462
+ return actor_ref (core::make_instance (actor_ref (), thread_opt,
463
+ std::make_unique<T>(std::forward<P>(p)...)),
475
464
false );
476
465
}
477
466
478
- template <typename T>
479
- inline actor_refspawn (actor_ref context,const actor_thread thread_opt) {
480
- return actor_ref (detail::make_instance<T>(
481
- std::move (context), thread_opt, std::make_unique<T>()),
467
+ template <typename T,typename ... P>
468
+ inline std::enable_if_t <std::is_base_of<::acto::actor, T>::value, actor_ref>
469
+ spawn (actor_ref context,const actor_thread thread_opt, P&&... p) {
470
+ return actor_ref (core::make_instance (std::move (context), thread_opt,
471
+ std::make_unique<T>(std::forward<P>(p)...)),
482
472
false );
483
473
}
484
474