The Nebula Device 3: Util::FixedArray< TYPE > Class Template Reference

The Nebula Device 3

Util::FixedArray< TYPE > Class Template Reference

#include <fixedarray.h>


Detailed Description

template<class TYPE>
class Util::FixedArray< TYPE >

Implements a fixed size one-dimensional array.

(C) 2006 Radon Labs GmbH


Public Types

typedef TYPE * Iterator
 define element iterator

Public Member Functions

 FixedArray ()
 default constructor
 FixedArray (SizeT s)
 constructor with size
 FixedArray (SizeT s, const TYPE &initialValue)
 constructor with size and initial value
 FixedArray (const FixedArray< TYPE > &rhs)
 copy constructor
 ~FixedArray ()
 destructor
void operator= (const FixedArray< TYPE > &rhs)
 assignment operator
TYPE & operator[] (IndexT index) const
 write [] operator
bool operator== (const FixedArray< TYPE > &rhs) const
 equality operator
bool operator!= (const FixedArray< TYPE > &rhs) const
 inequality operator
void SetSize (SizeT s)
 set number of elements (clears existing content)
SizeT Size () const
 get number of elements
void Resize (SizeT newSize)
 resize array without deleting existing content
bool IsEmpty () const
 return true if array if empty (has no elements)
void Clear ()
 clear the array, free elements
void Fill (const TYPE &val)
 fill the entire array with a value
void Fill (IndexT first, SizeT num, const TYPE &val)
 fill array range with element
Iterator Begin () const
 get iterator to first element
Iterator End () const
 get iterator past last element
Iterator Find (const TYPE &val) const
 find identical element in unsorted array (slow)
IndexT FindIndex (const TYPE &val) const
 find index of identical element in unsorted array (slow)
void Sort ()
 sort the array
IndexT BinarySearchIndex (const TYPE &val) const
 do a binary search, requires a sorted array
Array< TYPE > AsArray () const
 return content as Array (slow!)

Member Function Documentation

template<class TYPE>
IndexT Util::FixedArray< TYPE >::BinarySearchIndex ( const TYPE &  elm  )  const

do a binary search, requires a sorted array

Todo:
hmm, this is copy-pasted from Array...