]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/vector.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxVector<T>
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
11 wxVector<T> is a template class which implements most of the @c std::vector
12 class and can be used like it.
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".
18 Please refer to the STL documentation for further information.
23 @see @ref overview_container, wxList<T>, wxArray<T>
29 typedef size_t size_type
;
30 typedef size_t difference_type
;
32 typedef value_type
* pointer
;
33 typedef value_type
* iterator
;
34 typedef const value_type
* const_iterator
;
35 typedef value_type
& reference
;
38 Reverse iterator interface
40 class reverse_iterator
44 explicit reverse_iterator(iterator it
);
45 reverse_iterator(const reverse_iterator
& it
);
46 reference
operator*() const;
47 pointer
operator->() const;
48 iterator
base() const;
49 reverse_iterator
& operator++();
50 reverse_iterator
operator++(int);
51 reverse_iterator
& operator--();
52 reverse_iterator
operator--(int);
53 reverse_iterator
operator+(difference_type n
) const;
54 reverse_iterator
& operator+=(difference_type n
);
55 reverse_iterator
operator-(difference_type n
) const;
56 reverse_iterator
& operator-=(difference_type n
);
57 reference
operator[](difference_type n
) const;
58 bool operator ==(const reverse_iterator
& it
) const;
59 bool operator !=(const reverse_iterator
& it
) const;
70 wxVector(const wxVector
<T
>& c
);
78 Returns item at position @a idx.
80 const value_type
& at(size_type idx
) const;
83 Returns item at position @a idx.
85 value_type
& at(size_type idx
);
90 const value_type
& back() const;
98 Return iterator to beginning of the vector.
100 const_iterator
begin() const;
103 Return iterator to beginning of the vector.
108 Return reverse iterator to end of the vector.
110 reverse_iterator
rbegin();
113 Return reverse iterator to beginning of the vector.
115 reverse_iterator
rend();
119 Returns vector's current capacity, i.e. how much memory is allocated.
123 size_type
capacity() const;
131 Returns @true if the vector is empty.
136 Returns iterator to the end of the vector.
138 const_iterator
end() const;
141 Returns iterator to the end of the vector.
146 Erase item pointed to by iterator @a it.
148 @return Iterator pointing to the item immediately after the erased one.
150 iterator
erase(iterator it
);
153 Erase items in the range @a first to @a last (@a last is not erased).
155 @return Iterator pointing to the item immediately after the erased
158 iterator
erase(iterator first
, iterator last
);
161 Returns the first item.
163 const value_type
& front() const;
166 Returns the first item.
171 Insert item @a v at given position @a it.
173 @return Iterator for the inserted item.
175 iterator
insert(iterator it
, const value_type
& v
= value_type());
180 wxVector
& operator=(const wxVector
& vb
);
183 Returns item at position @a idx.
185 const value_type
& operator[](size_type idx
) const;
188 Returns item at position @a idx.
190 value_type
& operator[](size_type idx
);
193 Removes the last item.
198 Adds an item to the end of the vector.
200 void push_back(const value_type
& v
);
203 Reserves memory for at least @a n items.
207 void reserve(size_type n
);
210 Returns the size of the vector.
212 size_type
size() const;