]>
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
;
31 typedef value_type
* iterator
;
32 typedef const value_type
* const_iterator
;
33 typedef value_type
& reference
;
43 wxVector(const wxVector
<T
>& c
);
51 Returns item at position @a idx.
53 const value_type
& at(size_type idx
) const;
56 Returns item at position @a idx.
58 value_type
& at(size_type idx
);
63 const value_type
& back() const;
71 Return iterator to beginning of the vector.
73 const_iterator
begin() const;
76 Return iterator to beginning of the vector.
81 Returns vector's current capacity, i.e. how much memory is allocated.
85 size_type
capacity() const;
93 Returns @true if the vector is empty.
98 Returns iterator to the end of the vector.
100 const_iterator
end() const;
103 Returns iterator to the end of the vector.
108 Erase item pointed to by iterator @a it.
110 @return Iterator pointing to the item immediately after the erased one.
112 iterator
erase(iterator it
);
115 Erase items in the range @a first to @a last (@a last is not erased).
117 @return Iterator pointing to the item immediately after the erased
120 iterator
erase(iterator first
, iterator last
);
123 Returns the first item.
125 const value_type
& front() const;
128 Returns the first item.
133 Insert item @a v at given position @a it.
135 @return Iterator for the inserted item.
137 iterator
insert(iterator it
, const value_type
& v
= value_type());
142 wxVector
& operator=(const wxVector
& vb
);
145 Returns item at position @a idx.
147 const value_type
& operator[](size_type idx
) const;
150 Returns item at position @a idx.
152 value_type
& operator[](size_type idx
);
155 Removes the last item.
160 Adds an item to the end of the vector.
162 void push_back(const value_type
& v
);
165 Reserves memory for at least @a n items.
169 void reserve(size_type n
);
172 Returns the size of the vector.
174 size_type
size() const;