]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: vector.h | |
e54c96f1 | 3 | // Purpose: interface of wxVector<T> |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxVectorT | |
11 | @wxheader{vector.h} | |
7c913512 | 12 | |
23324ae1 FM |
13 | wxVectorT is a template class which implements most of the std::vector |
14 | class and can be used like it. If wxWidgets is compiled in STL mode, | |
15 | wxVector will just be a typedef to std::vector. Just like for std::vector, | |
16 | objects stored in wxVectorT need to be @e assignable but don't have to | |
17 | be @e default constructible. | |
7c913512 | 18 | |
23324ae1 | 19 | You can refer to the STL documentation for further information. |
7c913512 | 20 | |
23324ae1 FM |
21 | @library{wxbase} |
22 | @category{FIXME} | |
7c913512 | 23 | |
e54c96f1 | 24 | @see @ref overview_wxcontaineroverview, wxListT(), wxArrayT() |
23324ae1 | 25 | */ |
7c913512 | 26 | class wxVector<T> |
23324ae1 FM |
27 | { |
28 | public: | |
29 | //@{ | |
30 | /** | |
31 | Constructor. | |
32 | */ | |
33 | wxVectorT(); | |
7c913512 | 34 | wxVectorT(const wxVector<T>& c); |
23324ae1 FM |
35 | //@} |
36 | ||
37 | /** | |
38 | Destructor. | |
39 | */ | |
40 | ~wxVectorT(); | |
41 | ||
42 | //@{ | |
43 | /** | |
44 | Returns item at position @e idx. | |
45 | */ | |
46 | const value_type at(size_type idx); | |
328f5751 | 47 | const value_type at(size_type idx); |
23324ae1 FM |
48 | //@} |
49 | ||
50 | //@{ | |
51 | /** | |
52 | Return last item. | |
53 | */ | |
54 | const value_type back(); | |
328f5751 | 55 | const value_type back(); |
23324ae1 FM |
56 | //@} |
57 | ||
58 | //@{ | |
59 | /** | |
60 | Return iterator to beginning of the vector. | |
61 | */ | |
62 | const_iterator begin(); | |
328f5751 | 63 | const iterator begin(); |
23324ae1 FM |
64 | //@} |
65 | ||
66 | /** | |
67 | ||
68 | */ | |
328f5751 | 69 | size_type capacity() const; |
23324ae1 FM |
70 | |
71 | /** | |
72 | Clears the vector. | |
73 | */ | |
74 | void clear(); | |
75 | ||
76 | /** | |
77 | Returns @true if the vector is empty. | |
78 | */ | |
328f5751 | 79 | bool empty() const; |
23324ae1 FM |
80 | |
81 | //@{ | |
82 | /** | |
83 | Returns iterator to the end of the vector. | |
84 | */ | |
85 | const_iterator end(); | |
328f5751 | 86 | const iterator end(); |
23324ae1 FM |
87 | //@} |
88 | ||
89 | //@{ | |
90 | /** | |
7c913512 | 91 | Erase items. When using values other than built-in integrals |
23324ae1 FM |
92 | or classes with reference counting this can be an inefficient |
93 | operation. | |
94 | */ | |
95 | iterator erase(iterator it); | |
7c913512 | 96 | iterator erase(iterator first, iterator last); |
23324ae1 FM |
97 | //@} |
98 | ||
99 | //@{ | |
100 | /** | |
101 | Returns first item. | |
102 | */ | |
103 | const value_type front(); | |
328f5751 | 104 | const value_type front(); |
23324ae1 FM |
105 | //@} |
106 | ||
107 | /** | |
108 | ) | |
7c913512 | 109 | Insert an item. When using values other than built-in integrals |
23324ae1 FM |
110 | or classes with reference counting this can be an inefficient |
111 | operation. | |
112 | */ | |
113 | iterator insert(iterator it); | |
114 | ||
115 | /** | |
116 | Assignment operator. | |
117 | */ | |
118 | wxVectorT& operator operator=(const wxVector<T>& vb); | |
119 | ||
120 | //@{ | |
121 | /** | |
122 | Returns item at position @e idx. | |
123 | */ | |
124 | const value_type operator[](size_type idx); | |
328f5751 | 125 | const value_type operator[](size_type idx); |
23324ae1 FM |
126 | //@} |
127 | ||
128 | /** | |
129 | Removes the last item. | |
130 | */ | |
131 | void pop_back(); | |
132 | ||
133 | /** | |
134 | Adds an item to the end of the vector. | |
135 | */ | |
136 | void push_back(const value_type& v); | |
137 | ||
138 | /** | |
4cc4bfaf | 139 | Reserves more memory of @a n is greater then |
23324ae1 FM |
140 | wxVector::size. Other this call has |
141 | no effect. | |
142 | */ | |
143 | void reserve(size_type n); | |
144 | }; | |
e54c96f1 | 145 |