Array Class Template Reference

Inheritance diagram for Array:

NdPoint NdVector Ring List of all members.

Detailed Description

template<class T>
class Array< T >

Author:
Bill Smart

Version:
1.0
Date:
May 2005

Definition at line 44 of file Array.H.

STL integration

typedef T value_type
typedef value_typepointer
typedef const value_typeconst_pointer
typedef value_typereference
typedef const value_typeconst_reference
typedef ptrdiff_t difference_type
typedef size_t size_type
typedef pointer iterator
typedef const_pointer const_iterator
typedef std::reverse_iterator<
iterator
reverse_iterator
typedef std::reverse_iterator<
const_iterator
const_reverse_iterator
iterator begin ()
iterator end ()
const_iterator begin () const
const_iterator end () const
reverse_iterator rbegin ()
reverse_iterator rend ()
const_reverse_iterator rbegin () const
const_reverse_iterator rend () const

Public Member Functions

 Array (const int size)
 Array (const int size, const T &value)
 Array (const Array< T > &array)
 ~Array ()
Assignment
Array< T > & operator= (const Array< T > &array)
 Assign one array to another.
Array< T > & operator= (const T &value)
 Assign a value to all elements of the array.
Element access
reference operator[] (const size_type index)
const_reference operator[] (const size_type index) const
reference operator() (const size_type index)
const_reference operator() (const size_type index) const
Sizes
size_type size () const

Private Attributes

size_type m_size
T * m_data


Member Typedef Documentation

typedef T value_type

Reimplemented in Ring.

Definition at line 83 of file Array.H.

typedef value_type* pointer

Reimplemented in Ring.

Definition at line 85 of file Array.H.

typedef const value_type* const_pointer

Reimplemented in Ring.

Definition at line 86 of file Array.H.

typedef value_type& reference

Reimplemented in Ring.

Definition at line 87 of file Array.H.

typedef const value_type& const_reference

Reimplemented in Ring.

Definition at line 88 of file Array.H.

typedef ptrdiff_t difference_type

Reimplemented in Ring.

Definition at line 90 of file Array.H.

typedef size_t size_type

Reimplemented in Ring.

Definition at line 91 of file Array.H.

typedef pointer iterator

Reimplemented in Ring.

Definition at line 93 of file Array.H.

typedef const_pointer const_iterator

Reimplemented in Ring.

Definition at line 94 of file Array.H.

typedef std::reverse_iterator<iterator> reverse_iterator

Reimplemented in Ring.

Definition at line 102 of file Array.H.

typedef std::reverse_iterator<const_iterator> const_reverse_iterator

Reimplemented in Ring.

Definition at line 103 of file Array.H.


Constructor & Destructor Documentation

Array ( const int  size  )  [inline, explicit]

Allocate an array with the given size.

Parameters:
[in] size The size of the array.

Definition at line 48 of file Array.H.

References m_data.

Array ( const int  size,
const T &  value 
) [inline]

Allocate an array with the given size, and initialize each element to a particular value.

Parameters:
[in] size The size of the array.
[in] value The initial value for each element.

Definition at line 53 of file Array.H.

References m_data, and m_size.

Array ( const Array< T > &  array  )  [inline]

Definition at line 56 of file Array.H.

References m_data, and m_size.

~Array (  )  [inline]

Definition at line 59 of file Array.H.

References invalidate_pointer, and m_data.


Member Function Documentation

Array<T>& operator= ( const Array< T > &  array  )  [inline]

Assign one array to another.

If the array being assigned from is larger than the array being assigned to, data block holding the array will be deleted and reallocated.

Parameters:
[in] array The array to be assigned from.
Returns:
A reference to the modified array.

Definition at line 68 of file Array.H.

References m_data, and m_size.

Array<T>& operator= ( const T &  value  )  [inline]

Assign a value to all elements of the array.

Parameters:
[in] value The value to be assigned.
Returns:
A reference to the modified array.

Definition at line 76 of file Array.H.

References m_data, and m_size.

iterator begin (  )  [inline]

Definition at line 96 of file Array.H.

References m_data.

Referenced by rend().

iterator end (  )  [inline]

Definition at line 97 of file Array.H.

References m_data, and m_size.

Referenced by rbegin().

const_iterator begin (  )  const [inline]

Definition at line 99 of file Array.H.

References m_data.

const_iterator end (  )  const [inline]

Definition at line 100 of file Array.H.

References m_data, and m_size.

reverse_iterator rbegin (  )  [inline]

Definition at line 105 of file Array.H.

References end().

reverse_iterator rend (  )  [inline]

Definition at line 106 of file Array.H.

References begin().

const_reverse_iterator rbegin (  )  const [inline]

Definition at line 108 of file Array.H.

References end().

const_reverse_iterator rend (  )  const [inline]

Definition at line 109 of file Array.H.

References begin().

reference operator[] ( const size_type  index  )  [inline]

Reimplemented in Ring.

Definition at line 114 of file Array.H.

References assert_range, m_data, and m_size.

Referenced by LocalRing::operator[](), and Ring::operator[]().

const_reference operator[] ( const size_type  index  )  const [inline]

Reimplemented in Ring.

Definition at line 115 of file Array.H.

References assert_range, m_data, and m_size.

reference operator() ( const size_type  index  )  [inline]

Reimplemented in Ring.

Definition at line 117 of file Array.H.

References assert_range, m_data, and m_size.

Referenced by NdPoint::distance().

const_reference operator() ( const size_type  index  )  const [inline]

Reimplemented in Ring.

Definition at line 118 of file Array.H.

References assert_range, m_data, and m_size.

size_type size (  )  const [inline]

Definition at line 123 of file Array.H.

References m_size.

Referenced by Ring::wrap_index().


Member Data Documentation

size_type m_size [private]

Definition at line 127 of file Array.H.

Referenced by Array(), end(), operator()(), operator=(), operator[](), and size().

T* m_data [private]

Definition at line 128 of file Array.H.

Referenced by Array(), begin(), end(), operator()(), operator=(), operator[](), and ~Array().


The documentation for this class was generated from the following file:
Generated on Thu Feb 1 15:31:55 2007 for WURDE by  doxygen 1.5.1