[libsigc++2/variadic_bind4] C++11: Make all operator bool() explicit.



commit 6a8c86965e86d2482881bbebca08f4293a4ac1b2
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Mar 3 13:08:54 2016 +0100

    C++11: Make all operator bool() explicit.

 sigc++/connection.h         |    4 ++--
 sigc++/functors/slot_base.h |    2 +-
 tests/test_bind_refptr.cc   |    6 +-----
 3 files changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/sigc++/connection.h b/sigc++/connection.h
index 199b4e8..f8a55e2 100644
--- a/sigc++/connection.h
+++ b/sigc++/connection.h
@@ -104,11 +104,11 @@ struct SIGC_API connection : public notifiable
   /// Disconnects the referred slot.
   void disconnect();
 
-  //TODO: When we can break API and ABI, make operator bool() explicit and const
+  //TODO: When we can break API and ABI, make operator bool() const
   /** Returns whether the connection is still active.
    * @return @p true if the connection is still active.
    */
-  operator bool() noexcept;
+  explicit operator bool() noexcept;
 
   /** Callback that is executed when the referred slot is destroyed.
    * @param data The connection object notified (@p this).
diff --git a/sigc++/functors/slot_base.h b/sigc++/functors/slot_base.h
index e32deab..7111a2e 100644
--- a/sigc++/functors/slot_base.h
+++ b/sigc++/functors/slot_base.h
@@ -282,7 +282,7 @@ public:
    *  do_something()
    * @endcode
    */
-  operator bool() const noexcept;
+  explicit operator bool() const noexcept;
 
   typedef notifiable::func_destroy_notify func_destroy_notify;
 
diff --git a/tests/test_bind_refptr.cc b/tests/test_bind_refptr.cc
index a432cf1..f8fe446 100644
--- a/tests/test_bind_refptr.cc
+++ b/tests/test_bind_refptr.cc
@@ -127,7 +127,7 @@ public:
    *     do_something();
    * @endcode
    */
-  inline operator bool() const;
+  inline explicit operator bool() const;
 
 #ifndef GLIBMM_DISABLE_DEPRECATED
   /// @deprecated Use reset() instead because this leads to confusion with clear() methods on the underlying 
class. For instance, people use .clear() when they mean ->clear().
@@ -169,10 +169,6 @@ public:
   template <class T_CastFrom>
   static inline RefPtr<T_CppObject> cast_const(const RefPtr<T_CastFrom>& src);
 
-  //TODO: Maybe remove these if we replace operator bool() with operator const void* after
-  //an API/ABI break, as suggested by Daniel Elstner? murrayc.
-  //See bug https://bugzilla.gnome.org/show_bug.cgi?id=626858
-
   /** Compare based on the underlying instance address.
    *
    * This is needed in code that requires an ordering on


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]