]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/stack.h
added template wxScopedArray<> too
[wxWidgets.git] / include / wx / stack.h
index 8cd78bf271c9c565efae23d2665f7e22ad9a3ff4..835b736a6361d9fa0b47da0490217d44f8d99f9a 100644 (file)
@@ -5,7 +5,7 @@
 // Modified by:
 // Created:     30.07.2001
 // Copyright:   (c) 2001 Lindsay Mathieson <lindsay@mathieson.org>
-// Licence:     wxWindows license
+// Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_STACK_H_
 
 #include "wx/vector.h"
 
-#define WX_DECLARE_STL_STACK(obj, cls)\
-class cls : public wxVectorBase\
+#define WX_DECLARE_STACK(obj, cls) \
+class cls : public wxVector<obj> \
 {\
-       WX_DECLARE_STL_VECTORBASE(obj, cls);\
 public:\
-       void push(const obj& o)\
-       {\
-               bool rc = Alloc(size() + 1);\
-               wxASSERT(rc);\
-               Append(new obj(o));\
-       };\
+    void push(const obj& o)\
+    {\
+        push_back(o); \
+    };\
 \
-       void pop()\
-       {\
-               RemoveAt(size() - 1);\
-       };\
+    void pop()\
+    {\
+        pop_back(); \
+    };\
 \
-       obj& top()\
-       {\
-               return *(obj *) GetItem(size() - 1);\
-       };\
-       const obj& top() const\
-       {\
-               return *(obj *) GetItem(size() - 1);\
-       };\
+    obj& top()\
+    {\
+        return at(size() - 1);\
+    };\
+    const obj& top() const\
+    {\
+        return at(size() - 1); \
+    };\
 }
 
 #endif // _WX_STACK_H_