]>
git.saurik.com Git - wxWidgets.git/blob - interface/vector.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxVector<T>
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
12 wxVector<T> is a template class which implements most of the @c std::vector
13 class and can be used like it.
15 If wxWidgets is compiled in STL mode, wxVector will just be a typedef to @c
16 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.
19 Please refer to the STL documentation for further information.
24 @see @ref overview_container, wxList, wxArray
30 typedef size_t size_type
;
32 typedef value_type
* iterator
;
33 typedef const value_type
* const_iterator
;
34 typedef value_type
& reference
;
44 wxVector(const wxVector
<T
>& c
);
52 Returns item at position @e idx.
54 const value_type
& at(size_type idx
) const;
57 Returns item at position @e idx.
59 value_type
& at(size_type idx
);
64 const value_type
& back() const;
72 Return iterator to beginning of the vector.
74 const_iterator
begin() const;
77 Return iterator to beginning of the vector.
82 Returns vector's current capacity, i.e. how much memory is allocated.
86 size_type
capacity() const;
94 Returns @true if the vector is empty.
99 Returns iterator to the end of the vector.
101 const_iterator
end() const;
104 Returns iterator to the end of the vector.
109 Erase item pointed to by iterator @a it.
111 @return Iterator pointing to the item immediately after the erased one.
113 iterator
erase(iterator it
);
116 Erase items in the range @a first to @a last (@a last is not erased).
118 @return Iterator pointing to the item immediately after the
121 iterator
erase(iterator first
, iterator last
);
124 Returns the first item.
126 const value_type
& front() const;
129 Returns the first item.
134 Insert item @a v at given position @a it.
136 @return Iterator for the inserted item.
138 iterator
insert(iterator it
, const value_type
& v
= value_type());
143 wxVectorT
& operator operator=(const wxVector
<T
>& vb
);
146 Returns item at position @e idx.
148 const value_type
& operator[](size_type idx
) const;
151 Returns item at position @e idx.
153 value_type
& operator[](size_type idx
);
156 Removes the last item.
161 Adds an item to the end of the vector.
163 void push_back(const value_type
& v
);
166 Reserves memory for at least @a n items.
170 void reserve(size_type n
);