OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- Data Structures
- Class Hierarchy
- Data Fields

Public Member Functions
AutoDeleteSmallVector< T, S > Class Template Reference

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

`#include <smallvec_type.hpp>`

Inheritance diagram for AutoDeleteSmallVector< 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.
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
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 AutoDeleteSmallVector< T, S >

Simple vector template class, with automatic delete.

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

  T | The type of the items stored, must be a pointer
  S | The steps of allocation

Definition at line 401 of file smallvec_type.hpp.

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

- src/core/smallvec_type.hpp