OpenTTD
|
Simple vector template class, with automatic free. More...
#include <smallvec_type.hpp>
Public Member Functions | |
void | Clear () |
Remove all items from the list. | |
![]() | |
SmallVector (const SmallVector &other) | |
Copy constructor. | |
template<uint X> | |
SmallVector (const SmallVector< T, X > &other) | |
Generic copy constructor. | |
SmallVector & | operator= (const SmallVector &other) |
Assignment. | |
template<uint X> | |
SmallVector & | operator= (const SmallVector< T, X > &other) |
Generic assignment. | |
template<uint X> | |
void | Assign (const SmallVector< T, X > &other) |
Assign items from other vector. | |
void | Reset () |
Remove all items from the list and free allocated memory. | |
void | Compact () |
Compact the list down to the smallest block size boundary. | |
T * | Append (uint to_add=1) |
Append an item and return it. | |
void | Resize (uint num_items) |
Set the size of the vector, effectively truncating items from the end or appending uninitialised ones. | |
const T * | Find (const T &item) const |
Search for the first occurrence of an item. | |
T * | Find (const T &item) |
Search for the first occurrence of an item. | |
int | FindIndex (const T &item) const |
Search for the first occurrence of an item. | |
bool | Contains (const T &item) const |
Tests whether a item is present in the vector. | |
void | Erase (T *item) |
Removes given item from this vector. | |
void | ErasePreservingOrder (uint pos, uint count=1) |
Remove items from the vector while preserving the order of other items. | |
bool | Include (const T &item) |
Tests whether a item is present in the vector, and appends it to the end if not. | |
uint | Length () const |
Get the number of items in the list. | |
const T * | Begin () const |
Get the pointer to the first item (const) | |
T * | Begin () |
Get the pointer to the first item. | |
const T * | End () const |
Get the pointer behind the last valid item (const) | |
T * | End () |
Get the pointer behind the last valid item. | |
const T * | Get (uint index) const |
Get the pointer to item "number" (const) | |
T * | Get (uint index) |
Get the pointer to item "number". | |
const T & | operator[] (uint index) const |
Get item "number" (const) | |
T & | operator[] (uint index) |
Get item "number". |
Additional Inherited Members | |
![]() | |
T * | data |
The pointer to the first item. | |
uint | items |
The number of items stored. | |
uint | capacity |
The available space for storing items. |
Simple vector template class, with automatic free.
T | The type of the items stored, must be a pointer |
S | The steps of allocation |
Definition at line 368 of file smallvec_type.hpp.