|
Melon
A C++ library designed for RadishOS.
|
A linear dynamic generic container. TODO: if possible, support objects with no default constructor. More...
#include <Vector.hpp>
Public Member Functions | |
| Vector () | |
| Default constructor. | |
| template<Typing::USize N> | |
| Vector (const T(&objects)[N]) | |
| Constructs the vector from existing objects. | |
| Vector (const Vector< T > &other) | |
| Copy constructor. | |
| Vector (Vector< T > &&other) | |
| Move constructor. | |
| const T * | begin (this const Vector< T > &self) |
| Gets a pointer to the base of the data. | |
| const T * | end (this const Vector< T > &self) |
| Gets a pointer to the end of the data. | |
| void | pushBack (this Vector< T > &self, const T &object) |
| Add an object to the end of the vector. | |
| template<typename... ARGS> | |
| void | emplaceBack (this Vector< T > &self, ARGS &&...args) |
| Constructs an object and add it at the end of the vector. | |
| T & | popBack (this Vector< T > &self) |
| Removes the last object from the vector. | |
| void | erase (this Vector< T > &self, Typing::USize index) |
| Erases object at a given position in the vector. | |
| void | clear (this Vector< T > &self) |
| Clears the vector. | |
| const T * | data (this const Vector< T > &self) |
| Gets a pointer to the internal buffer storage. | |
| Memory::Buffer< T > | toBuffer (this const Vector< T > &self) |
| Gets a copy of the internal buffer. | |
| Typing::USize | length (this const Vector< T > &self) |
| Gets the length of the vector. | |
| Typing::USize | capacity (this const Vector< T > &self) |
| Gets the capacity of the vector. | |
| bool | isEmpty (this const Vector< T > &self) |
| Checks if the vector is empty. | |
| bool | operator== (this const Vector< T > &self, const Vector< T > &other) |
| Checks if both buffers are the same. | |
| T & | operator[] (this Vector< T > &self, Typing::USize index) |
| Gets an object from the vector. | |
| const T & | operator[] (this const Vector< T > &self, Typing::USize index) |
| Gets an object from the vector. | |
| Vector< T > & | operator= (this Vector< T > &self, const Vector< T > &other) |
| Copy assignment operator. | |
| Vector< T > & | operator= (this Vector< T > &self, Vector< T > &&other) |
| Move assignment operator. | |
A linear dynamic generic container. TODO: if possible, support objects with no default constructor.
|
inline |
Default constructor.
Allocates minimal space to store the buffer.
|
inline |
Constructs the vector from existing objects.
| objects | array of objects |
|
inline |
Copy constructor.
| other | vector to copy |
|
inline |
Move constructor.
| other | vector to move |
|
inline |
Gets a pointer to the base of the data.
|
inline |
Gets the capacity of the vector.
|
inline |
Gets a pointer to the internal buffer storage.
|
inline |
Constructs an object and add it at the end of the vector.
If the number of objects in the vector exceeds the vector's capacity, the buffer is extended to two times the current capacity.
| args | constructor arguments |
|
inline |
Gets a pointer to the end of the data.
|
inline |
Erases object at a given position in the vector.
| index | object position |
|
inline |
Checks if the vector is empty.
|
inline |
Gets the length of the vector.
|
inline |
Copy assignment operator.
| other | vector to copy |
|
inline |
Move assignment operator.
| other | vector to copy |
|
inline |
Checks if both buffers are the same.
This checks for the buffer only, not for the object count and capacity.
|
inline |
Gets an object from the vector.
| index | object position |
|
inline |
Gets an object from the vector.
| index | object position |
|
inline |
Removes the last object from the vector.
Actually, the object is not removed. The object count is basically decremented, making the last object unaccessible.
|
inline |
Add an object to the end of the vector.
If the number of objects in the vector exceeds the vector's capacity, the buffer is extended to two times the current capacity.
| object | object to add |
|
inline |
Gets a copy of the internal buffer.