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