|
Data Structures & Algorithms in C++
Goodrich, Tamassia, Mount and Goldwasser
|
dynamically sized array, as simplified version of std::vector More...
#include <vector.h>

Data Structures | |
| class | const_iterator |
| class | iterator |
Public Member Functions | |
| Vector () | |
| Constructs an empty vector. | |
| int | capacity () const |
| int | size () const |
| bool | empty () const |
| const T & | operator[] (int i) const |
| T & | operator[] (int i) |
| const T & | at (int i) const |
| T & | at (int i) |
| const T & | front () const |
| T & | front () |
| const T & | back () const |
| T & | back () |
| void | push_back (const T &elem) |
| void | pop_back () |
| Removes an element from the end of the vector. | |
| void | insert (int i, const T &elem) |
| void | erase (int i) |
| void | reserve (int minimum) |
| Vector (const Vector &other) | |
| Copy constructor. | |
| Vector & | operator= (const Vector &other) |
| Copy assignment. | |
| Vector (Vector &&other) | |
| Move constructor. | |
| Vector & | operator= (Vector &&other) |
| Move assignment. | |
| ~Vector () | |
| Destructor. | |
| iterator | begin () |
| iterator | end () |
| const_iterator | begin () const |
| const_iterator | end () const |
| iterator | insert (iterator it, const T &elem) |
| iterator | erase (iterator it) |
dynamically sized array, as simplified version of std::vector
|
inline |
Constructs an empty vector.
|
inline |
Copy constructor.
|
inline |
Move constructor.
|
inline |
Destructor.
|
inline |
Returns reference to the element at index i; raises out_of_range exception with invalid index
| i | index of desired element |
| out_of_range | exception if index is invalid for current vector |
|
inline |
Returns const reference to the element at index i; raises out_of_range exception with invalid index
| i | index of desired element |
| out_of_range | exception if index is invalid for current vector |
|
inline |
Returns a live reference to the last element; behavior is undefined if vector is empty
|
inline |
Returns a const reference to the last element; behavior is undefined if vector is empty
|
inline |
|
inline |
|
inline |
Returns the current capacity of the underlying array
|
inline |
Tests whether the vector is empty.
|
inline |
|
inline |
|
inline |
Removes element at index i; behavior is undefined if i is out of bounds
| i | index of element to be removed |
|
inline |
Removes the element at the given iterator position
| it | iterator defining the position of element to be removed |

|
inline |
Returns a live reference to the first element; behavior is undefined if vector is empty
|
inline |
Returns a const reference to the first element; behavior is undefined if vector is empty
|
inline |
Inserts an element at index i; behavior is undefined if i is out of bounds
| i | index at which new element should be placed |
| elem | the new element |

|
inline |
Inserts an element immediately before the given iterator position
| it | iterator defining the insertion position |
| elem | the new element |

|
inline |
Copy assignment.
|
inline |
Move assignment.
|
inline |
Returns reference to the element at index i; behavior is undefined if i is out of bounds
| i | index of desired element |
|
inline |
Returns const reference to the element at index i; behavior is undefined if i is out of bounds
| i | index of desired element |
|
inline |
Removes an element from the end of the vector.
|
inline |
Inserts an element at end of the vector
| elem | the new element |

|
inline |
Requests that the vector capacity be at least as large as the indicated capacity The function has no effect if the current capacity is already larger than the parameter.
| cap | the minimum capacity after the operation |
|
inline |
Returns the number of elements stored