diff --git a/autowiring/Autowired.h b/autowiring/Autowired.h index c7787a53e..a90222da6 100644 --- a/autowiring/Autowired.h +++ b/autowiring/Autowired.h @@ -306,13 +306,17 @@ class AutoDesired: /// template class AutoConstruct: - public AutoRequired + public std::shared_ptr { public: template AutoConstruct(Args&&... args) : - AutoRequired(CoreContext::CurrentContext(), std::forward(args)...) + std::shared_ptr(CoreContext::CurrentContext()->template Construct(std::forward(args)...)) {} + + operator bool(void) const { return IsAutowired(); } + operator T*(void) const { return std::shared_ptr::get(); } + bool IsAutowired(void) const { return std::shared_ptr::get() != nullptr; } }; ///