X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ddf5de5b463d9056ea2cc988feb4141dff5bdd64..90d26317f7613d64c81a5b09b578c5144c2bab1b:/include/wx/hashmap.h diff --git a/include/wx/hashmap.h b/include/wx/hashmap.h index 621bd6c528..896cd12db0 100644 --- a/include/wx/hashmap.h +++ b/include/wx/hashmap.h @@ -20,6 +20,10 @@ #include // for ptrdiff_t +#ifdef __WXWINCE__ +typedef int ptrdiff_t; +#endif + // private struct WXDLLIMPEXP_BASE _wxHashTable_NodeBase { @@ -563,5 +567,19 @@ public: \ _WX_DECLARE_HASH_MAP( void*, VALUE_T, wxPointerHash, wxPointerEqual, \ CLASSNAME, class WXDLLEXPORT ) +// delete all hash elements +// +// NB: the class declaration of the hash elements must be visible from the +// place where you use this macro, otherwise the proper destructor may not +// be called (a decent compiler should give a warning about it, but don't +// count on it)! +#define WX_CLEAR_HASH_MAP(type, hashmap) \ + { \ + type::iterator it, en; \ + for( it = (hashmap).begin(), en = (hashmap).end(); it != en; ++it ) \ + delete it->second; \ + (hashmap).clear(); \ + } + #endif // _WX_HASHMAP_H_