From dac8712fcfdc1d50cedf45865d98cad011a00a2c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 15 Sep 2008 16:12:07 +0000 Subject: [PATCH] document wxDELETE() and wxDELETEA() (now committing the right file, please disregard comment of r55648) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55649 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- interface/wx/defs.h | 57 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/interface/wx/defs.h b/interface/wx/defs.h index 07c981a0a2..36deb822ec 100644 --- a/interface/wx/defs.h +++ b/interface/wx/defs.h @@ -302,6 +302,44 @@ enum wxPaperSize */ #define DECLARE_NO_COPY_TEMPLATE_CLASS(classname, arg) +/** + A function which deletes and nulls the pointer. + + This function uses operator delete to free the pointer and also sets it to + @NULL. Notice that this does @em not work for arrays, use wxDELETEA() for + them. + + @code + MyClass *ptr = new MyClass; + ... + wxDELETE(ptr); + wxASSERT(!ptr); + @endcode + + @header{wx/defs.h} +*/ +template wxDELETE(T*& ptr); + +/** + A function which deletes and nulls the pointer. + + This function uses vector operator delete (@c delete[]) to free the array + pointer and also sets it to @NULL. Notice that this does @em not work for + non-array pointers, use wxDELETE() for them. + + @code + MyClass *array = new MyClass[17]; + ... + wxDELETEA(array); + wxASSERT(!array); + @endcode + + @see wxDELETE() + + @header{wx/defs.h} +*/ +template wxDELETEA(T*& array); + /** This macro can be used around a function declaration to generate warnings indicating that this function is deprecated (i.e. obsolete and planned to @@ -402,6 +440,25 @@ enum wxPaperSize */ #define wxSUPPRESS_GCC_PRIVATE_DTOR_WARNING(name) +/** + Swaps the contents of two variables. + + This is similar to std::swap() but can be used even on the platforms where + the standard C++ library is not available (if you don't target such + platforms, please use std::swap() instead). + + The function relies on type T being copy constructible and assignable. + + Example of use: + @code + int x = 3, + y = 4; + wxSwap(x, y); + wxASSERT( x == 4 && y == 3 ); + @endcode + */ +template wxSwap(T& first, T& second); + /** This macro is the same as the standard C99 @c va_copy for the compilers which support it or its replacement for those that don't. It must be used -- 2.45.2