summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2019-06-20 12:58:46 -0700
committerWilliam A. Kennington III <wak@google.com>2019-07-08 16:26:42 -0700
commitcbaeb1a38314cb92bfa487659ae9225e28421091 (patch)
treee0fa4f233363aed850af44db69c7a05f0e3ba6dd /src
parent64725031be90808f918423527cd2a32627bdf285 (diff)
downloadstdplus-cbaeb1a38314cb92bfa487659ae9225e28421091.tar.gz
stdplus-cbaeb1a38314cb92bfa487659ae9225e28421091.zip
handle: Make it possible to reference stored data
Users of the handle often want to be able to reference data they plan to use in their callbacks. This is especially useful for retrieving references to dependency injected interfaces. Change-Id: I2782794d7d8320e3a0dd7f47320e35d75303167a Signed-off-by: William A. Kennington III <wak@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/stdplus/handle/managed.hpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/stdplus/handle/managed.hpp b/src/stdplus/handle/managed.hpp
index 361c1ec..9b9bfb5 100644
--- a/src/stdplus/handle/managed.hpp
+++ b/src/stdplus/handle/managed.hpp
@@ -161,6 +161,19 @@ struct Managed
reset(std::nullopt);
}
+ /** @brief Reference the contained data
+ *
+ * @return A reference to the contained data
+ */
+ constexpr const std::tuple<As...>& data() const noexcept
+ {
+ return as;
+ }
+ constexpr std::tuple<As...>& data() noexcept
+ {
+ return as;
+ }
+
protected:
/* Hold the data parameterized for this container */
std::tuple<As...> as;
OpenPOWER on IntegriCloud