diff options
author | Murray Cumming <murrayc@murrayc.com> | 2016-03-03 13:08:54 +0100 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2016-03-03 13:11:06 +0100 |
commit | 6a8c86965e86d2482881bbebca08f4293a4ac1b2 (patch) | |
tree | a7c2ba4259daa52e9aa36c606526c1aeb31ba336 | |
parent | 0af06bb9703f67a07316153983361a70b7c53757 (diff) | |
download | sigc++-6a8c86965e86d2482881bbebca08f4293a4ac1b2.tar.gz |
C++11: Make all operator bool() explicit.
-rw-r--r-- | sigc++/connection.h | 4 | ||||
-rw-r--r-- | sigc++/functors/slot_base.h | 2 | ||||
-rw-r--r-- | 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 |