X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/89969a91289c3c99b6d55c2ac918ddb8a3f0f0bc..fc32630a5e03e60a67d4ef53fc59985ea087b451:/include/wx/ptr_scpd.h?ds=sidebyside diff --git a/include/wx/ptr_scpd.h b/include/wx/ptr_scpd.h index 100e6bdd0a..2ae40220c9 100644 --- a/include/wx/ptr_scpd.h +++ b/include/wx/ptr_scpd.h @@ -55,6 +55,14 @@ public: delete m_ptr; } + // test for pointer validity: defining conversion to unspecified_bool_type + // and not more obvious bool to avoid implicit conversions to integer types + typedef T *(wxScopedPtr::*unspecified_bool_type)() const; + operator unspecified_bool_type() const + { + return m_ptr ? &wxScopedPtr::get : NULL; + } + void reset(T * ptr = NULL) { if (m_ptr != ptr)