Skip to content

Commit

Permalink
AutoConstruct should not inherit AutoRequired
Browse files Browse the repository at this point in the history
  • Loading branch information
codemercenary committed Aug 26, 2014
1 parent aad15dd commit c98db1b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions autowiring/Autowired.h
Original file line number Diff line number Diff line change
Expand Up @@ -306,13 +306,17 @@ class AutoDesired:
/// </summary>
template<class T>
class AutoConstruct:
public AutoRequired<T>
public std::shared_ptr<T>
{
public:
template<class... Args>
AutoConstruct(Args&&... args) :
AutoRequired<T>(CoreContext::CurrentContext(), std::forward<Args>(args)...)
std::shared_ptr<T>(CoreContext::CurrentContext()->template Construct<T>(std::forward<Args&&>(args)...))
{}

operator bool(void) const { return IsAutowired(); }
operator T*(void) const { return std::shared_ptr<T>::get(); }
bool IsAutowired(void) const { return std::shared_ptr<T>::get() != nullptr; }
};

/// <summary>
Expand Down

0 comments on commit c98db1b

Please sign in to comment.