X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/89969a91289c3c99b6d55c2ac918ddb8a3f0f0bc..613de0e89efab1cbf8463ea06e0cf0b2914fbce9:/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)