added vector and stack classes (UNTESTED)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10893 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-07-07 23:16:38 +00:00
parent 5438a5665e
commit 3c648a82a5
3 changed files with 254 additions and 0 deletions

44
include/wx/stack.h Normal file
View File

@@ -0,0 +1,44 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/stack.h
// Purpose: STL stack clone
// Author: Lindsay Mathieson
// Modified by:
// Created: 30.07.2001
// Copyright: (c) 2001 Lindsay Mathieson <lindsay@mathieson.org>
// Licence: wxWindows license
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_STACK_H_
#define _WX_STACK_H_
#include "wx/vector.h"
#define WX_DECLARE_STL_STACK(obj, cls)\
class cls : public wxVectorBase\
{\
WX_DECLARE_STL_VECTORBASE(obj, cls);\
public:\
void push(const obj& o)\
{\
bool rc = Alloc(size() + 1);\
wxASSERT(rc);\
Append(new obj(o));\
};\
\
void pop()\
{\
RemoveAt(size() - 1);\
};\
\
obj& top()\
{\
return *(obj *) GetItem(size() - 1);\
};\
const obj& top() const\
{\
return *(obj *) GetItem(size() - 1);\
};\
}
#endif // _WX_STACK_H_