[libsigcplusplus/libsigc++-2-8] Deprecate sigc::ref() in favor of std::ref().
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsigcplusplus/libsigc++-2-8] Deprecate sigc::ref() in favor of std::ref().
- Date: Tue, 8 Mar 2016 10:14:19 +0000 (UTC)
commit b11cf2b9d758fa4e8ac301d8b82d0dfd708b5ded
Author: Murray Cumming <murrayc murrayc com>
Date: Tue Mar 8 11:13:28 2016 +0100
Deprecate sigc::ref() in favor of std::ref().
sigc++/adaptors/macros/bind.h.m4 | 6 +++---
sigc++/reference_wrapper.h | 32 ++++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+), 3 deletions(-)
---
diff --git a/sigc++/adaptors/macros/bind.h.m4 b/sigc++/adaptors/macros/bind.h.m4
index 495f7fb..1284d91 100644
--- a/sigc++/adaptors/macros/bind.h.m4
+++ b/sigc++/adaptors/macros/bind.h.m4
@@ -320,14 +320,14 @@ struct count_void<void,void,void,void,void,void,void>
* @endcode
*
* You can bind references to functors by passing the objects through
- * the sigc::ref() helper function.
+ * the std::ref() or std::cref() functions.
*
* @par Example:
* @code
* int some_int;
* sigc::signal<void> some_signal;
* void foo(int&);
- * some_signal.connect(sigc::bind(&foo,sigc::ref(some_int)));
+ * some_signal.connect(sigc::bind(&foo, std::ref(some_int)));
* @endcode
*
* If you bind an object of a sigc::trackable derived type to a functor
@@ -339,7 +339,7 @@ struct count_void<void,void,void,void,void,void,void>
* struct bar : public sigc::trackable {} some_bar;
* sigc::signal<void> some_signal;
* void foo(bar&);
- * some_signal.connect(sigc::bind(&foo,sigc::ref(some_bar)));
+ * some_signal.connect(sigc::bind(&foo, std::ref(some_bar)));
* // disconnected automatically if some_bar goes out of scope
* @endcode
*
diff --git a/sigc++/reference_wrapper.h b/sigc++/reference_wrapper.h
index 5a57e91..35b2ab6 100644
--- a/sigc++/reference_wrapper.h
+++ b/sigc++/reference_wrapper.h
@@ -21,8 +21,12 @@
namespace sigc {
+#ifndef SIGCXX_DISABLE_DEPRECATED
+
/** Reference wrapper.
* Use sigc::ref() to create a reference wrapper.
+ *
+ * @deprecated Use std::ref() or std::cref() instead to create a std::reference_wrapper().
*/
template <class T_type>
struct reference_wrapper
@@ -38,6 +42,8 @@ struct reference_wrapper
/** Const reference wrapper.
* Use sigc::ref() to create a const reference wrapper.
+ *
+ * @deprecated Use std::ref() or std::cref() instead to create a std::reference_wrapper().
*/
template <class T_type>
struct const_reference_wrapper
@@ -60,6 +66,8 @@ struct const_reference_wrapper
*
* @param v Reference to store.
* @return A reference wrapper.
+ *
+ * @deprecated Use std::ref() or std::cref() instead.
*/
template <class T_type>
reference_wrapper<T_type> ref(T_type& v)
@@ -74,17 +82,27 @@ reference_wrapper<T_type> ref(T_type& v)
*
* @param v Reference to store.
* @return A reference wrapper.
+ *
+ * @deprecated Use std::ref() or std::cref() instead.
*/
template <class T_type>
const_reference_wrapper<T_type> ref(const T_type& v)
{ return const_reference_wrapper<T_type>(v); }
+#endif // SIGCXX_DISABLE_DEPRECATED
+
+
template <class T_type>
struct unwrap_reference
{
typedef T_type type;
};
+
+#ifndef SIGCXX_DISABLE_DEPRECATED
+
+// Specializations for std::reference_wrapper and std::const_reference_wrapper:
+
template <class T_type>
struct unwrap_reference<reference_wrapper<T_type> >
{
@@ -105,6 +123,20 @@ template <class T_type>
const T_type& unwrap(const const_reference_wrapper<T_type>& v)
{ return v; }
+#endif // SIGCXX_DISABLE_DEPRECATED
+
+//Specializations for std::reference_wrapper:
+
+template <class T_type>
+struct unwrap_reference<std::reference_wrapper<T_type> >
+{
+ typedef T_type& type;
+};
+
+template <class T_type>
+T_type& unwrap(const std::reference_wrapper<T_type>& v)
+{ return v; }
+
} /* namespace sigc */
#endif /* _SIGC_REFERENCE_WRAPPER_H_ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]