OpenTTD
Public Member Functions
AutoFreeSmallVector< T, S > Class Template Reference

Simple vector template class, with automatic free. More...

#include <smallvec_type.hpp>

Inheritance diagram for AutoFreeSmallVector< T, S >:
SmallVector< T, S >

Public Member Functions

void Clear ()
 Remove all items from the list.
 
- Public Member Functions inherited from SmallVector< T, S >
 SmallVector (const SmallVector &other)
 Copy constructor. More...
 
template<uint X>
 SmallVector (const SmallVector< T, X > &other)
 Generic copy constructor. More...
 
SmallVectoroperator= (const SmallVector &other)
 Assignment. More...
 
template<uint X>
SmallVectoroperator= (const SmallVector< T, X > &other)
 Generic assignment. More...
 
template<uint X>
void Assign (const SmallVector< T, X > &other)
 Assign items from other vector.
 
void Clear ()
 Remove all items from the list.
 
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. More...
 
void Resize (uint num_items)
 Set the size of the vector, effectively truncating items from the end or appending uninitialised ones. More...
 
const T * Find (const T &item) const
 Search for the first occurrence of an item. More...
 
T * Find (const T &item)
 Search for the first occurrence of an item. More...
 
int FindIndex (const T &item) const
 Search for the first occurrence of an item. More...
 
bool Contains (const T &item) const
 Tests whether a item is present in the vector. More...
 
void Erase (T *item)
 Removes given item from this vector. More...
 
void ErasePreservingOrder (uint pos, uint count=1)
 Remove items from the vector while preserving the order of other items. More...
 
bool Include (const T &item)
 Tests whether a item is present in the vector, and appends it to the end if not. More...
 
uint Length () const
 Get the number of items in the list. More...
 
const T * Begin () const
 Get the pointer to the first item (const) More...
 
T * Begin ()
 Get the pointer to the first item. More...
 
const T * End () const
 Get the pointer behind the last valid item (const) More...
 
T * End ()
 Get the pointer behind the last valid item. More...
 
const T * Get (uint index) const
 Get the pointer to item "number" (const) More...
 
T * Get (uint index)
 Get the pointer to item "number". More...
 
const T & operator[] (uint index) const
 Get item "number" (const) More...
 
T & operator[] (uint index)
 Get item "number". More...
 

Additional Inherited Members

- Protected Attributes inherited from SmallVector< T, S >
T * data
 The pointer to the first item.
 
uint items
 The number of items stored.
 
uint capacity
 The available space for storing items.
 

Detailed Description

template<typename T, uint S>
class AutoFreeSmallVector< T, S >

Simple vector template class, with automatic free.

Note
There are no asserts in the class so you have to care about that you grab an item which is inside the list.
Parameters
TThe type of the items stored, must be a pointer
SThe steps of allocation

Definition at line 370 of file smallvec_type.hpp.


The documentation for this class was generated from the following file: