v1.1.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Modules Pages
Public Member Functions | Static Public Member Functions | List of all members
Sifteo::Array< T, tCapacity, sizeT > Class Template Reference

A statically sized array. More...

#include <sifteo/array.h>

Public Member Functions

T & append (const T &newItem)
 Synonym for push_back()
 
T & append ()
 Synonym for push_back()
 
 Array ()
 Initialize a new empty array.
 
iterator begin ()
 Return an iterator pointing to the first slot in the array.
 
void clear ()
 Equivalent to setCount(0)
 
unsigned count () const
 How many items does this array currently hold?
 
bool empty () const
 Is this array empty?
 
iterator end ()
 Return an iterator pointing just past the last in-use slot in the array.
 
void erase (unsigned index)
 Remove a specific element, by index, and shift the others down.
 
void erase (iterator item)
 Remove the element at iterator 'item' and shift the others down.
 
void erase_tail ()
 Remove the last element, which involves no shifting.
 
unsigned find (T itemToFind)
 
const T & operator[] (unsigned index) const
 Accessor for array elements.
 
const T & operator[] (int index) const
 Accessor for array elements.
 
T & operator[] (unsigned index)
 Accessor for array elements.
 
T & operator[] (int index)
 Accessor for array elements.
 
pop_back ()
 Deallocate the last element and return a copy of it's value.
 
void pop_back (T *outValue)
 Pop-back, but avoid a potential unnecessary copy.
 
T & push_back (const T &newItem)
 Copy 'newItem' to the first unused slot in the array, and return a reference to the copy.
 
T & push_back ()
 Allocate the first unused slot in the array, and return an reference to this uninitialized slot.
 
void setCount (unsigned c)
 Change the number of elements currently in the array. More...
 

Static Public Member Functions

static unsigned capacity ()
 Retrieve the capacity of this array, always constant at compile-time.
 

Detailed Description

template<typename T, unsigned tCapacity, typename sizeT = uint32_t>
class Sifteo::Array< T, tCapacity, sizeT >

A statically sized array.

Method naming and conventions are STL-inspired, but designed for very minimal runtime memory footprint.

Member Function Documentation

template<typename T, unsigned tCapacity, typename sizeT = uint32_t>
unsigned Sifteo::Array< T, tCapacity, sizeT >::find ( itemToFind)
inline

Locate an item by equality comparison.

Using operator==(), tests 'itemToFind' against all items in the array, returning the index of the first match, if any. If no elements are found, returns the static member constant NOT_FOUND.

template<typename T, unsigned tCapacity, typename sizeT = uint32_t>
void Sifteo::Array< T, tCapacity, sizeT >::setCount ( unsigned  c)
inline

Change the number of elements currently in the array.

If this is less than the current count, the array is truncated. If it is greater than the current count, the added elements will have undefined values.


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