[libsigcplusplus/libsigc++-2-8] Also ifdef out bound_argument<sigc::reference_wrapper>.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsigcplusplus/libsigc++-2-8] Also ifdef out bound_argument<sigc::reference_wrapper>.
- Date: Tue, 8 Mar 2016 10:27:27 +0000 (UTC)
commit 993aabc7b8afdd1ac06d97a3147452f820181ef5
Author: Murray Cumming <murrayc murrayc com>
Date: Tue Mar 8 11:24:32 2016 +0100
Also ifdef out bound_argument<sigc::reference_wrapper>.
And add a specialization for bound_argument<std::reference_wrapper>.
sigc++/adaptors/bound_argument.h | 40 ++++++++++++++++++++++++++++++++++++++
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()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]