Skip to content

Commit 37d1706

Browse files
committed
C++11: Make all operator bool() explicit.
1 parent 801bb2c commit 37d1706

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

sigc++/connection.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,11 @@ struct SIGC_API connection
104104
/// Disconnects the referred slot.
105105
void disconnect();
106106

107-
//TODO: When we can break API and ABI, make operator bool() explicit and const
107+
//TODO: When we can break API and ABI, make operator bool() const
108108
/** Returns whether the connection is still active.
109109
* @return @p true if the connection is still active.
110110
*/
111-
operator bool() noexcept;
111+
explicit operator bool() noexcept;
112112

113113
/** Callback that is executed when the referred slot is destroyed.
114114
* @param data The connection object notified (@p this).

sigc++/functors/slot_base.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ class SIGC_API slot_base : public functor_base
282282
* do_something()
283283
* @endcode
284284
*/
285-
operator bool() const noexcept;
285+
explicit operator bool() const noexcept;
286286

287287
/** Sets the parent of this slot.
288288
* This function is used by signals to register a notification callback.

tests/test_bind_refptr.cc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class RefPtr
127127
* do_something();
128128
* @endcode
129129
*/
130-
inline operator bool() const;
130+
inline explicit operator bool() const;
131131

132132
#ifndef GLIBMM_DISABLE_DEPRECATED
133133
/// @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 @@ class RefPtr
169169
template <class T_CastFrom>
170170
static inline RefPtr<T_CppObject> cast_const(const RefPtr<T_CastFrom>& src);
171171

172-
//TODO: Maybe remove these if we replace operator bool() with operator const void* after
173-
//an API/ABI break, as suggested by Daniel Elstner? murrayc.
174-
//See bug https://bugzilla.gnome.org/show_bug.cgi?id=626858
175-
176172
/** Compare based on the underlying instance address.
177173
*
178174
* This is needed in code that requires an ordering on

0 commit comments

Comments
 (0)