-#define WX_DECLARE_VECTORBASE(obj, cls)\
-protected:\
- virtual void Free(void *o)\
- {\
- delete (obj *) o;\
- }\
- virtual void *Copy(const void *o) const\
- {\
- return new obj(*(obj *) o);\
- }\
-public:\
- cls() {}\
- cls(const cls& c) : wxVectorBase()\
- {\
- wxCHECK2(copy(c), return);\
- }\
- ~cls()\
- {\
- clear();\
- }
-
-#define _WX_DECLARE_VECTOR(obj, cls, exp)\
-class exp cls : public wxVectorBase\
-{\
- WX_DECLARE_VECTORBASE(obj, cls)\
-public:\
- void push_back(const obj& o)\
- {\
- wxCHECK2(Alloc(size() + 1), return);\
- Append(new obj(o));\
- }\
- void pop_back()\
- {\
- RemoveAt(size() - 1);\
- }\
- const obj& at(size_type idx) const\
- {\
- return *(obj *) GetItem(idx);\
- }\
- obj& at(size_type idx)\
- {\
- return *(obj *) GetItem(idx);\
- }\
- const obj& operator[](size_type idx) const\
- {\
- return at(idx);\
- }\
- obj& operator[](size_type idx)\
- {\
- return at(idx);\
- }\
- const obj& front() const\
- {\
- return at(0);\
- }\
- obj& front()\
- {\
- return at(0);\
- }\
- const obj& back() const\
- {\
- return at(size() - 1);\
- }\
- obj& back()\
- {\
- return at(size() - 1);\
- }\
- size_type erase(size_type idx)\
- {\
- RemoveAt(idx);\
- return idx;\
- }\
-}
-
-#define WX_DECLARE_VECTOR(obj, cls) \
- _WX_DECLARE_VECTOR(obj, cls, WXDLLEXPORT)