|
ScapeGoatTree
|
#include <vector.hpp>
Public Member Functions | |
| ~Vector () | |
| Vector ()=default | |
| unsigned int | size () const |
| void | push_back (const T &value) |
| T | pop_back () |
| T * | begin () |
| T * | end () |
| T & | operator[] (unsigned int index) |
| const T & | operator[] (unsigned int index) const |
| Vector (const Vector &other) | |
| Vector & | operator= (const Vector &other) |
| Vector (Vector &&other) noexcept | |
| Vector & | operator= (Vector &&other) noexcept |
Private Attributes | |
| unsigned int | _size = 50 |
| int | nElements = 0 |
| T * | data = new T[_size]{} |
Friends | |
| template<typename > | |
| class | Stack |
| template<typename > | |
| class | ScapeGoatTree |
Destroys the vector and releases the dynamically allocated memory.
Provides access to the element at the specified index.
Provides read-only access to the element at the specified index.
Removes and returns the last element. Throws std::out_of_range if the vector is empty. Shrinks internal storage when usage falls to 1/4 of capacity (min capacity 50).
Appends a new element to the end of the vector, resizing if necessary.
Returns the number of elements currently stored in the vector.