]> git.saurik.com Git - wxWidgets.git/blob - interface/vector.h
compilation fix for PCH-less build
[wxWidgets.git] / interface / vector.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: vector.h
3 // Purpose: interface of wxVector<T>
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @wxheader{vector.h}
11
12 wxVector<T> is a template class which implements most of the @c std::vector
13 class and can be used like it.
14
15 If wxWidgets is compiled in STL mode, wxVector will just be a typedef to
16 @c std::vector. Just like for @c std::vector, objects stored in wxVector<T>
17 need to be @e assignable but don't have to be @e "default constructible".
18
19 Please refer to the STL documentation for further information.
20
21 @nolibrary
22 @category{containers}
23
24 @see @ref overview_container, wxList<T>, wxArray<T>
25 */
26 template<typename T>
27 class wxVector<T>
28 {
29 public:
30 typedef size_t size_type;
31 typedef T value_type;
32 typedef value_type* iterator;
33 typedef const value_type* const_iterator;
34 typedef value_type& reference;
35
36 /**
37 Constructor.
38 */
39 wxVector();
40
41 /**
42 Copy onstructor.
43 */
44 wxVector(const wxVector<T>& c);
45
46 /**
47 Destructor.
48 */
49 ~wxVector();
50
51 /**
52 Returns item at position @a idx.
53 */
54 const value_type& at(size_type idx) const;
55
56 /**
57 Returns item at position @a idx.
58 */
59 value_type& at(size_type idx);
60
61 /**
62 Return the last item.
63 */
64 const value_type& back() const;
65
66 /**
67 Return the last item.
68 */
69 value_type& back();
70
71 /**
72 Return iterator to beginning of the vector.
73 */
74 const_iterator begin() const;
75
76 /**
77 Return iterator to beginning of the vector.
78 */
79 iterator begin();
80
81 /**
82 Returns vector's current capacity, i.e. how much memory is allocated.
83
84 @see reserve()
85 */
86 size_type capacity() const;
87
88 /**
89 Clears the vector.
90 */
91 void clear();
92
93 /**
94 Returns @true if the vector is empty.
95 */
96 bool empty() const;
97
98 /**
99 Returns iterator to the end of the vector.
100 */
101 const_iterator end() const;
102
103 /**
104 Returns iterator to the end of the vector.
105 */
106 iterator end();
107
108 /**
109 Erase item pointed to by iterator @a it.
110
111 @return Iterator pointing to the item immediately after the erased one.
112 */
113 iterator erase(iterator it);
114
115 /**
116 Erase items in the range @a first to @a last (@a last is not erased).
117
118 @return Iterator pointing to the item immediately after the erased
119 range.
120 */
121 iterator erase(iterator first, iterator last);
122
123 /**
124 Returns the first item.
125 */
126 const value_type& front() const;
127
128 /**
129 Returns the first item.
130 */
131 value_type& front();
132
133 /**
134 Insert item @a v at given position @a it.
135
136 @return Iterator for the inserted item.
137 */
138 iterator insert(iterator it, const value_type& v = value_type());
139
140 /**
141 Assignment operator.
142 */
143 wxVector& operator=(const wxVector& vb);
144
145 /**
146 Returns item at position @a idx.
147 */
148 const value_type& operator[](size_type idx) const;
149
150 /**
151 Returns item at position @a idx.
152 */
153 value_type& operator[](size_type idx);
154
155 /**
156 Removes the last item.
157 */
158 void pop_back();
159
160 /**
161 Adds an item to the end of the vector.
162 */
163 void push_back(const value_type& v);
164
165 /**
166 Reserves memory for at least @a n items.
167
168 @see capacity()
169 */
170 void reserve(size_type n);
171
172 /**
173 Returns the size of the vector.
174 */
175 size_type size() const;
176 };
177