]> git.saurik.com Git - wxWidgets.git/blame - include/wx/stack.h
OS X compilation fix
[wxWidgets.git] / include / wx / stack.h
CommitLineData
3c648a82
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/stack.h
3// Purpose: STL stack clone
4// Author: Lindsay Mathieson
5// Modified by:
6// Created: 30.07.2001
7// Copyright: (c) 2001 Lindsay Mathieson <lindsay@mathieson.org>
65571936 8// Licence: wxWindows licence
3c648a82
VZ
9///////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_STACK_H_
12#define _WX_STACK_H_
13
14#include "wx/vector.h"
15
e18e17f9 16#define WX_DECLARE_STACK(obj, cls)\
3c648a82
VZ
17class cls : public wxVectorBase\
18{\
d775fa82 19 WX_DECLARE_VECTORBASE(obj, cls);\
3c648a82 20public:\
d775fa82
WS
21 void push(const obj& o)\
22 {\
e2985da8
VZ
23 if ( !Alloc(size() + 1) )\
24 {\
25 wxFAIL_MSG(_T("failed to extend stack"));\
26 }\
d775fa82
WS
27 Append(new obj(o));\
28 };\
3c648a82 29\
d775fa82
WS
30 void pop()\
31 {\
32 RemoveAt(size() - 1);\
33 };\
3c648a82 34\
d775fa82
WS
35 obj& top()\
36 {\
37 return *(obj *) GetItem(size() - 1);\
38 };\
39 const obj& top() const\
40 {\
41 return *(obj *) GetItem(size() - 1);\
42 };\
3c648a82
VZ
43}
44
45#endif // _WX_STACK_H_
46