summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2016-03-08 11:24:32 +0100
committerMurray Cumming <murrayc@murrayc.com>2016-03-08 11:24:34 +0100
commit993aabc7b8afdd1ac06d97a3147452f820181ef5 (patch)
treeec7652b45995bc89bbdc20801b09c99abf6c3761
parentc21aba8a028f0b9b33bc0f0254f80e897738e911 (diff)
downloadsigc++-993aabc7b8afdd1ac06d97a3147452f820181ef5.tar.gz
Also ifdef out bound_argument<sigc::reference_wrapper>.
And add a specialization for bound_argument<std::reference_wrapper>.
-rw-r--r--sigc++/adaptors/bound_argument.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/sigc++/adaptors/bound_argument.h b/sigc++/adaptors/bound_argument.h
index 0579682..272a6c3 100644
--- a/sigc++/adaptors/bound_argument.h
+++ b/sigc++/adaptors/bound_argument.h
@@ -75,6 +75,8 @@ private:
T_type visited_;
};
+#ifndef SIGCXX_DISABLE_DEPRECATED
+
//Template specialization:
/** bound_argument object for a bound argument that is passed by bind() or
* returned by bind_return() by reference, specialized for reference_wrapper<> types.
@@ -142,6 +144,44 @@ private:
const_limit_reference<T_wrapped> visited_;
};
+#endif // SIGCXX_DISABLE_DEPRECATED
+
+//Template specialization:
+/** bound_argument object for a bound argument that is passed by bind() or
+ * returned by bind_return() by reference, specialized for std::reference_wrapper<> types.
+ * @e T_wrapped The type of the bound argument.
+ */
+template <class T_wrapped>
+class bound_argument< std::reference_wrapper<T_wrapped> >
+{
+public:
+ /** Constructor.
+ * @param _A_argument The argument to bind.
+ */
+ bound_argument(const std::reference_wrapper<T_wrapped>& _A_argument)
+ : visited_(unwrap(_A_argument))
+ {}
+
+ /** Retrieve the entity to visit in visit_each().
+ * @return The limited_reference to the bound argument.
+ */
+ inline const limit_reference<T_wrapped>& visit() const
+ { return visited_; }
+
+ /** Retrieve the entity to pass to the bound functor or return.
+ * @return The bound argument.
+ */
+ inline T_wrapped& invoke()
+ { return visited_.invoke(); }
+
+private:
+ /** The limited_reference to the bound argument.
+ */
+ limit_reference<T_wrapped> visited_;
+};
+
+
+
#ifndef DOXYGEN_SHOULD_SKIP_THIS
/** Implementation of visitor<>::do_visit_each<>() specialized for the bound_argument class.
* Call visit_each() on the entity returned by the bound_argument's visit()