From 04660cf796d36d1cf7b2919d1da603ae97ed9a4d Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Fri, 6 May 2016 12:35:05 -0700 Subject: [PATCH] Add overload to ContextEnumerator to allow it to work from a reference Convenience routine, and it's also slightly more efficient than the other version, which may require a copy. --- src/autowiring/ContextEnumerator.cpp | 4 ++++ src/autowiring/ContextEnumerator.h | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/autowiring/ContextEnumerator.cpp b/src/autowiring/ContextEnumerator.cpp index 7eedb89c0..f0c016a87 100644 --- a/src/autowiring/ContextEnumerator.cpp +++ b/src/autowiring/ContextEnumerator.cpp @@ -9,6 +9,10 @@ ContextEnumerator::ContextEnumerator(void) : m_root(CoreContext::CurrentContext()) {} +ContextEnumerator::ContextEnumerator(CoreContext& root) : + m_root(root.shared_from_this()) +{} + ContextEnumerator::ContextEnumerator(const std::shared_ptr& root) : m_root(root) {} diff --git a/src/autowiring/ContextEnumerator.h b/src/autowiring/ContextEnumerator.h index c3bb944ed..d06bc154a 100644 --- a/src/autowiring/ContextEnumerator.h +++ b/src/autowiring/ContextEnumerator.h @@ -32,6 +32,11 @@ class ContextEnumerator /// ContextEnumerator(void); + /// + /// Constructs a context enumerator for the current context + /// + ContextEnumerator(CoreContext& root); + /// /// Constructs an enumerator which may enumerate all of the contexts rooted at the specified root ///