]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/stack.h
fixed memory leak in wxXmlResource introduced when fixing wxVector<> usage (patch...
[wxWidgets.git] / include / wx / stack.h
index 53f5121c2cde1de81690dcca298a17fde305f196..835b736a6361d9fa0b47da0490217d44f8d99f9a 100644 (file)
 
 #include "wx/vector.h"
 
-#define WX_DECLARE_STACK(obj, cls)\
-class cls : public wxVectorBase\
+#define WX_DECLARE_STACK(obj, cls) \
+class cls : public wxVector<obj> \
 {\
-    WX_DECLARE_VECTORBASE(obj, cls);\
 public:\
     void push(const obj& o)\
     {\
-        if ( !Alloc(size() + 1) )\
-        {\
-            wxFAIL_MSG(_T("failed to extend stack"));\
-        }\
-        Append(new obj(o));\
+        push_back(o); \
     };\
 \
     void pop()\
     {\
-        RemoveAt(size() - 1);\
+        pop_back(); \
     };\
 \
     obj& top()\
     {\
-        return *(obj *) GetItem(size() - 1);\
+        return at(size() - 1);\
     };\
     const obj& top() const\
     {\
-        return *(obj *) GetItem(size() - 1);\
+        return at(size() - 1); \
     };\
 }