From 0de67362be5fa5a1bc045701c9dc36c05c423809 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 24 Jun 2012 20:29:24 +0000 Subject: - added template mir_ptr for automatic memory deallocation using mir_free(); - mir_ptr used in MSN git-svn-id: http://svn.miranda-ng.org/main/trunk@614 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/m_system_cpp.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include') diff --git a/include/m_system_cpp.h b/include/m_system_cpp.h index a04898e427..9d872480e9 100644 --- a/include/m_system_cpp.h +++ b/include/m_system_cpp.h @@ -38,6 +38,17 @@ extern LIST_INTERFACE li; #define HandleKeySortT -2 #define PtrKeySortT -3 +template class mir_ptr +{ + T* data; + +public: + __inline mir_ptr(T* _p) : data(_p) {} + __inline ~mir_ptr() { mir_free(data); } + __inline operator T*() const { return data; } + __inline operator INT_PTR() const { return (INT_PTR)data; } +}; + template struct LIST { typedef int (*FTSortFunc)(const T* p1, const T* p2); -- cgit v1.2.3