HyperspaceExplorer 0.7.1
Public Member Functions | Private Attributes
ArrayList< size, T > Class Template Reference

A list of elements of arbitrary type defined at compile time. More...

#include <ArrayList.h>

Inheritance diagram for ArrayList< size, T >:
Inheritance graph
[legend]
Collaboration diagram for ArrayList< size, T >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ArrayList ()
 Create an ArrayList with default-constructed elements.
 ArrayList (const T &x)
 Create an ArrayList with all elements initialized to x.
 ArrayList (const T &head, const ArrayList< size-1, T > &tail)
 Create an ArrayList from a smaller ArrayList and an additional element.
const T & head () const
 Return the first element of an ArrayList.
T & head ()
const ArrayList< size-1, T > & tail () const
 Return an ArrayList that contains all but the first element.
ArrayList< size-1, T > & tail ()
const T & operator[] (unsigned i) const
 Read-only access to an element of the ArrayList.
T & operator[] (unsigned i)
 Read-write access to an element of the ArrayList.
ArrayList< size-1, T > minusElement (unsigned i) const
 Return an ArrayList that contains all but the given element.
bool contains (const T &x) const
std::string toString () const
 String representation.

Private Attributes

std::pair< T, ArrayList< size-1,
T > > 
_elements
 Stores the elements of the list in a pair of an element and a shorter list.

Detailed Description

template<unsigned size, typename T>
class ArrayList< size, T >

A list of elements of arbitrary type defined at compile time.

Template Parameters:
sizeNumber of elements in the ArrayList.
TType of the stored elements.

Constructor & Destructor Documentation

template<unsigned size, typename T>
ArrayList< size, T >::ArrayList ( const T &  x)

Create an ArrayList with all elements initialized to x.

Parameters:
xThe value all elements of this are initialized to.

References make_pair().

Here is the call graph for this function:

template<unsigned size, typename T>
ArrayList< size, T >::ArrayList ( const T &  head,
const ArrayList< size-1, T > &  tail 
)

Create an ArrayList from a smaller ArrayList and an additional element.

Parameters:
headValue of the first element
tailThe rest of the elements

References make_pair().

Here is the call graph for this function:


Member Function Documentation

template<unsigned size, typename T >
const T & ArrayList< size, T >::operator[] ( unsigned  i) const

Read-only access to an element of the ArrayList.

Parameters:
iIndex of the element accessed.
template<unsigned size, typename T >
T & ArrayList< size, T >::operator[] ( unsigned  i)

Read-write access to an element of the ArrayList.

Parameters:
iIndex of the element accessed.

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends

Generated on Mon Apr 9 2012 20:25:17 for HyperspaceExplorer 0.7.1 by doxygen 1.7.4  -  Hosted bySourceForge.net Logo