X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/89969a91289c3c99b6d55c2ac918ddb8a3f0f0bc..4f2511d706e5274a34e1521e11c1b95fed735b42:/include/wx/ptr_scpd.h 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)