Update wxStack class macro for the new wxVector

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48523 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2007-09-03 03:05:50 +00:00
parent 09da4ae594
commit c21ee7925b

View File

@@ -14,31 +14,26 @@
#include "wx/vector.h" #include "wx/vector.h"
#define WX_DECLARE_STACK(obj, cls) \ #define WX_DECLARE_STACK(obj, cls) \
class cls : public wxVectorBase\ class cls : public wxVector<obj> \
{\ {\
WX_DECLARE_VECTORBASE(obj, cls);\
public:\ public:\
void push(const obj& o)\ void push(const obj& o)\
{\ {\
if ( !Alloc(size() + 1) )\ push_back(o); \
{\
wxFAIL_MSG(_T("failed to extend stack"));\
}\
Append(new obj(o));\
};\ };\
\ \
void pop()\ void pop()\
{\ {\
RemoveAt(size() - 1);\ pop_back(); \
};\ };\
\ \
obj& top()\ obj& top()\
{\ {\
return *(obj *) GetItem(size() - 1);\ return at(size() - 1);\
};\ };\
const obj& top() const\ const obj& top() const\
{\ {\
return *(obj *) GetItem(size() - 1);\ return at(size() - 1); \
};\ };\
} }