Skip to content

Commit

Permalink
Merge pull request #83 from leapmotion/ref-autoconstruct
Browse files Browse the repository at this point in the history
AutoConstruct should not inherit AutoRequired
  • Loading branch information
gtremper committed Aug 26, 2014
2 parents ce334e3 + c98db1b commit 26e2a3a
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 26e2a3a

Please sign in to comment.