BLOCXX_NAMESPACE::Array< T > Class Template Reference

Array<> wraps std::vector<> in COWReference<> adding ref counting and copy on write capability. More...

#include <Array.hpp>

Inheritance diagram for BLOCXX_NAMESPACE::Array< T >:
BLOCXX_NAMESPACE::Stack< T >

List of all members.

Public Types

typedef V::value_type value_type
typedef V::pointer pointer
typedef V::const_pointer const_pointer
typedef V::iterator iterator
typedef V::const_iterator const_iterator
typedef V::reference reference
typedef V::const_reference const_reference
typedef V::size_type size_type
typedef V::difference_type difference_type
typedef V::reverse_iterator reverse_iterator
typedef V::const_reverse_iterator const_reverse_iterator

Public Member Functions

 Array ()
 Default Constructor.
 ~Array ()
 Destructor.
 Array (V *toWrap)
 Constructor.
 Array (size_type n, const T &value)
 Construct an Array that consist of a specified number of elements that are copies of a given object.
 Array (int n, const T &value)
 Construct an Array that consist of a specified number of elements that are copies of a given object.
 Array (long n, const T &value)
 Construct an Array that consist of a specified number of elements that are copies of a given object.
 Array (size_type n)
 Construct an Array that consist of a specified number of elements that have be constructed using the default constructor of class T.
template<class InputIterator >
 Array (InputIterator first, InputIterator last)
 Construct an Array from a range specified with InputIterators.
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
reverse_iterator rbegin ()
const_reverse_iterator rbegin () const
reverse_iterator rend ()
const_reverse_iterator rend () const
size_type size () const
size_type max_size () const
size_type capacity () const
bool empty () const
reference operator[] (size_type n)
 Retrieve A read/write reference to an object in the Array at a given index.
const_reference operator[] (size_type n) const
 Retrieve A read only reference to an object in the Array at a given index.
Array< T > & operator+= (const T &x)
 Append an object to the end of the Array.
void reserve (size_type n)
 Ensure the capacity is at least the size of a given value.
reference front ()
const_reference front () const
reference back ()
const_reference back () const
void push_back (const T &x)
 Append an element to the end of the Array.
void append (const T &x)
 Append an element to the end of the Array.
void swap (Array< T > &x)
 Swap the elements of this Array with the elements of another.
iterator insert (iterator position, const T &x)
 Insert an element in the Array before an element specified by an iterator.
void insert (size_type position, const T &x)
 Insert an element in the Array before an element specified by an index.
void remove (size_type index)
 Remove an element from the Array at a given index.
void remove (size_type begin, size_type end)
 Remove an element specified by a range.
template<class InputIterator >
void insert (iterator position, InputIterator first, InputIterator last)
 Insert a range of elements before a given position in the Array.
void appendArray (const Array< T > &x)
 Append the elements of another Array to the end of this Array.
void pop_back ()
 Remove the last element of the Array.
iterator erase (iterator position)
 Remove an element of the Array specified with an iterator.
iterator erase (iterator first, iterator last)
 Remove elements of the Array specified by a beginning and ending iterator.
void resize (size_type new_size, const T &x)
 Ensure the Array is a given size.
void resize (size_type new_size)
 Ensure the Array is a given size.
void clear ()
 Remove all items from the Array.
const_iterator find (const T &x, const_iterator first, const_iterator last) const
 Find element x in the array range specified by the first and last iterators.
const_iterator find (const T &x) const
 Find element x in the array.
iterator find (const T &x, iterator first, iterator last)
 Find element x in the array range specified by the first and last iterators.
iterator find (const T &x)
 Find element x in the array.
bool contains (const T &x, const_iterator first, const_iterator last) const
 Determine if element x is contained in the array range specified by the first and last iterators.
bool contains (const T &x) const
 Determine if element x is contained in the array.

Private Types

typedef std::vector< T,
std::allocator< T > > 
V

Private Attributes

COWReference< Vm_impl

Friends

bool operator== (const Array< T > &x, const Array< T > &y)
 Determine equality of two Arrays.
bool operator< (const Array< T > &x, const Array< T > &y)
 Determine if one Array is less than another.

Detailed Description

template<class T>
class BLOCXX_NAMESPACE::Array< T >

Array<> wraps std::vector<> in COWReference<> adding ref counting and copy on write capability.

It also adds valid range checks to operator[] if BLOCXX_CHECK_ARRAY_INDEXING is defined.

Invariants: See std::vector<> Thread safety: read Copy semantics: Copy On Write Exception safety: same as std::vector<T>

Definition at line 65 of file Array.hpp.


Member Typedef Documentation

template<class T>
typedef V::const_iterator BLOCXX_NAMESPACE::Array< T >::const_iterator

Definition at line 85 of file Array.hpp.

template<class T>
typedef V::const_pointer BLOCXX_NAMESPACE::Array< T >::const_pointer

Definition at line 83 of file Array.hpp.

template<class T>
typedef V::const_reference BLOCXX_NAMESPACE::Array< T >::const_reference

Reimplemented in BLOCXX_NAMESPACE::Stack< T >.

Definition at line 87 of file Array.hpp.

template<class T>
typedef V::const_reverse_iterator BLOCXX_NAMESPACE::Array< T >::const_reverse_iterator

Definition at line 91 of file Array.hpp.

template<class T>
typedef V::difference_type BLOCXX_NAMESPACE::Array< T >::difference_type

Definition at line 89 of file Array.hpp.

template<class T>
typedef V::iterator BLOCXX_NAMESPACE::Array< T >::iterator

Definition at line 84 of file Array.hpp.

template<class T>
typedef V::pointer BLOCXX_NAMESPACE::Array< T >::pointer

Definition at line 82 of file Array.hpp.

template<class T>
typedef V::reference BLOCXX_NAMESPACE::Array< T >::reference

Reimplemented in BLOCXX_NAMESPACE::Stack< T >.

Definition at line 86 of file Array.hpp.

template<class T>
typedef V::reverse_iterator BLOCXX_NAMESPACE::Array< T >::reverse_iterator

Definition at line 90 of file Array.hpp.

template<class T>
typedef V::size_type BLOCXX_NAMESPACE::Array< T >::size_type

Reimplemented in BLOCXX_NAMESPACE::Stack< T >.

Definition at line 88 of file Array.hpp.

template<class T>
typedef std::vector<T, std::allocator<T> > BLOCXX_NAMESPACE::Array< T >::V [private]

Definition at line 67 of file Array.hpp.

template<class T>
typedef V::value_type BLOCXX_NAMESPACE::Array< T >::value_type

Definition at line 81 of file Array.hpp.


Constructor & Destructor Documentation

template<typename T >
BLOCXX_NAMESPACE::Array< T >::Array (  )  [inline]

Default Constructor.

Definition at line 55 of file ArrayImpl.hpp.

template<typename T >
BLOCXX_NAMESPACE::Array< T >::~Array (  )  [inline]

Destructor.

Definition at line 61 of file ArrayImpl.hpp.

template<typename T >
BLOCXX_NAMESPACE::Array< T >::Array ( V toWrap  )  [inline, explicit]

Constructor.

Parameters:
toWrap The std::vector to wrap with this Array object.

Definition at line 66 of file ArrayImpl.hpp.

template<typename T>
BLOCXX_NAMESPACE::Array< T >::Array ( size_type  n,
const T &  value 
) [inline]

Construct an Array that consist of a specified number of elements that are copies of a given object.

Parameters:
n Number of elements the Array will contain.
value The value every element of the array will be initialized to.

Definition at line 72 of file ArrayImpl.hpp.

template<typename T>
BLOCXX_NAMESPACE::Array< T >::Array ( int  n,
const T &  value 
) [inline]

Construct an Array that consist of a specified number of elements that are copies of a given object.

Parameters:
n Number of elements the Array will contain.
value The value every element of the array will be initialized to.

Definition at line 78 of file ArrayImpl.hpp.

template<typename T>
BLOCXX_NAMESPACE::Array< T >::Array ( long  n,
const T &  value 
) [inline]

Construct an Array that consist of a specified number of elements that are copies of a given object.

Parameters:
n Number of elements the Array will contain.
value The value every element of the array will be initialized to.

Definition at line 84 of file ArrayImpl.hpp.

template<typename T>
BLOCXX_NAMESPACE::Array< T >::Array ( size_type  n  )  [inline, explicit]

Construct an Array that consist of a specified number of elements that have be constructed using the default constructor of class T.

Parameters:
n Number of elements the Array will contain.

Definition at line 90 of file ArrayImpl.hpp.

template<typename T >
template<class InputIterator >
BLOCXX_NAMESPACE::Array< T >::Array ( InputIterator  first,
InputIterator  last 
) [inline]

Construct an Array from a range specified with InputIterators.

Parameters:
first The iterator for the beginning of the range.
last The iterator for the end of the range.

Definition at line 97 of file ArrayImpl.hpp.


Member Function Documentation

template<typename T>
void BLOCXX_NAMESPACE::Array< T >::append ( const T &  x  )  [inline]

Append an element to the end of the Array.

This is identical to push_back.

Parameters:
x The element to append to the end of the Array.

Definition at line 258 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::push_back().

Referenced by BLOCXX_NAMESPACE::MultiAppender::addLogAppender(), BLOCXX_NAMESPACE::DelayedFormat::append(), BLOCXX_NAMESPACE::FileSystem::getDirectoryContents(), and BLOCXX_NAMESPACE::String::tokenize().

template<typename T>
void BLOCXX_NAMESPACE::Array< T >::appendArray ( const Array< T > &  x  )  [inline]

Append the elements of another Array to the end of this Array.

Parameters:
x The Array the elements will be copied from.

Definition at line 315 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::begin(), BLOCXX_NAMESPACE::Array< T >::end(), and BLOCXX_NAMESPACE::Array< T >::insert().

template<typename T >
Array< T >::const_reference BLOCXX_NAMESPACE::Array< T >::back (  )  const [inline]
Returns:
A read only reference to the last element of the Array.

Definition at line 244 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

template<typename T >
Array< T >::reference BLOCXX_NAMESPACE::Array< T >::back (  )  [inline]
Returns:
A read/write reference to the last element of the Array.

Definition at line 237 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

Referenced by BLOCXX_NAMESPACE::Stack< T >::top().

template<typename T >
Array< T >::const_iterator BLOCXX_NAMESPACE::Array< T >::begin (  )  const [inline]
Returns:
A read only iterator that points to the first element in the Array. Iteration is done in the normal order (1st to last) with the returned iterator.

Definition at line 111 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

template<typename T >
Array< T >::iterator BLOCXX_NAMESPACE::Array< T >::begin (  )  [inline]
Returns:
A read/write iterator that points to the first element in the Array. Iteration is done in the normal order (1st to last) with the returned iterator.

Definition at line 104 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

Referenced by BLOCXX_NAMESPACE::Array< T >::appendArray(), BLOCXX_NAMESPACE::Array< T >::contains(), BLOCXX_NAMESPACE::Cstr::CstrArr< Array< S > >::CstrArr(), BLOCXX_NAMESPACE::DateTime::DateTime(), BLOCXX_NAMESPACE::Array< T >::find(), and BLOCXX_NAMESPACE::LogMessagePatternFormatter::formatMessage().

template<typename T >
Array< T >::size_type BLOCXX_NAMESPACE::Array< T >::capacity (  )  const [inline]
Returns:
The space that is currently allocated to hold the elements. This value will be >= size()

Definition at line 174 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

template<typename T >
void BLOCXX_NAMESPACE::Array< T >::clear (  )  [inline]

Remove all items from the Array.

The size() of the Array should be zero after calling this method.

Definition at line 357 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

Referenced by BLOCXX_NAMESPACE::FileSystem::getDirectoryContents().

template<typename T>
bool BLOCXX_NAMESPACE::Array< T >::contains ( const T &  x  )  const [inline]

Determine if element x is contained in the array.

Parameters:
x The element to seach for.
Returns:
true if the element x is contained in the array.

Definition at line 413 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::begin(), BLOCXX_NAMESPACE::Array< T >::end(), and BLOCXX_NAMESPACE::Array< T >::find().

template<typename T>
bool BLOCXX_NAMESPACE::Array< T >::contains ( const T &  x,
const_iterator  first,
const_iterator  last 
) const [inline]

Determine if element x is contained in the array range specified by the first and last iterators.

Parameters:
x The element to seach for.
first The first position iterator; begin of the range.
last The last position iterator; end of the range.
Returns:
true if the element x is contained in the specified range of the array.

Definition at line 406 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::end(), and BLOCXX_NAMESPACE::Array< T >::find().

template<typename T >
bool BLOCXX_NAMESPACE::Array< T >::empty (  )  const [inline]
Returns:
true if the Array is empty (contains zero elements)

Reimplemented in BLOCXX_NAMESPACE::Stack< T >.

Definition at line 181 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

template<typename T >
Array< T >::const_iterator BLOCXX_NAMESPACE::Array< T >::end (  )  const [inline]
Returns:
A read only iterator that points one past the last element in the Array. Iteration is done in the normal order (1st to last) with the returned iterator.

Definition at line 125 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

template<typename T >
Array< T >::iterator BLOCXX_NAMESPACE::Array< T >::end (  )  [inline]
Returns:
A read/write iterator that points one past the last element in the Array. Iteration is done in the normal order (1st to last) with the returned iterator.

Definition at line 118 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

Referenced by BLOCXX_NAMESPACE::Array< T >::appendArray(), BLOCXX_NAMESPACE::Array< T >::contains(), BLOCXX_NAMESPACE::Cstr::CstrArr< Array< S > >::CstrArr(), BLOCXX_NAMESPACE::DateTime::DateTime(), BLOCXX_NAMESPACE::Array< T >::find(), and BLOCXX_NAMESPACE::LogMessagePatternFormatter::formatMessage().

template<typename T >
Array< T >::iterator BLOCXX_NAMESPACE::Array< T >::erase ( iterator  first,
iterator  last 
) [inline]

Remove elements of the Array specified by a beginning and ending iterator.

Parameters:
first An iterator that specifies the first element to remove.
last An iterator that specifies the last element to remove.
Returns:
An iterator that points to the element in the Array following the removed elements.

Definition at line 336 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

template<typename T >
Array< T >::iterator BLOCXX_NAMESPACE::Array< T >::erase ( iterator  position  )  [inline]

Remove an element of the Array specified with an iterator.

Parameters:
position An iterator that points to the element to be removed.
Returns:
An iterator that points to the element in the Array following the removed element.

Definition at line 329 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

template<typename T>
Array< T >::iterator BLOCXX_NAMESPACE::Array< T >::find ( const T &  x  )  [inline]

Find element x in the array.

Parameters:
x The element to seach for.
Returns:
An read/write iterator pointing to the found element or the end iterator pointing one past the last element in the array.

Definition at line 399 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::begin(), BLOCXX_NAMESPACE::Array< T >::end(), and BLOCXX_NAMESPACE::Array< T >::find().

template<typename T>
Array< T >::iterator BLOCXX_NAMESPACE::Array< T >::find ( const T &  x,
iterator  first,
iterator  last 
) [inline]

Find element x in the array range specified by the first and last iterators.

Parameters:
x The element to seach for.
first The first position iterator; begin of the range.
last The last position iterator; end of the range.
Returns:
An read/write iterator pointing to the found element or the end iterator pointing one past the last element in the array.

Definition at line 385 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::end().

template<typename T>
Array< T >::const_iterator BLOCXX_NAMESPACE::Array< T >::find ( const T &  x  )  const [inline]

Find element x in the array.

Parameters:
x The element to seach for.
Returns:
An read only iterator pointing to the found element or the end iterator pointing one past the last element in the array.

Definition at line 378 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::begin(), BLOCXX_NAMESPACE::Array< T >::end(), and BLOCXX_NAMESPACE::Array< T >::find().

template<typename T>
Array< T >::const_iterator BLOCXX_NAMESPACE::Array< T >::find ( const T &  x,
const_iterator  first,
const_iterator  last 
) const [inline]

Find element x in the array range specified by the first and last iterators.

Parameters:
x The element to seach for.
first The first position iterator; begin of the range.
last The last position iterator; end of the range.
Returns:
An read only iterator pointing to the found element or the end iterator pointing one past the last element in the array.

Definition at line 364 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::end().

Referenced by BLOCXX_NAMESPACE::Array< T >::contains(), BLOCXX_NAMESPACE::Array< T >::find(), and BLOCXX_NAMESPACE::Stack< T >::search().

template<typename T >
Array< T >::const_reference BLOCXX_NAMESPACE::Array< T >::front (  )  const [inline]
Returns:
A read only reference to the first element of the Array.

Definition at line 230 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

template<typename T >
Array< T >::reference BLOCXX_NAMESPACE::Array< T >::front (  )  [inline]
Returns:
A read/write reference to the first element of the Array.

Definition at line 223 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

template<typename T >
template<class InputIterator >
void BLOCXX_NAMESPACE::Array< T >::insert ( iterator  position,
InputIterator  first,
InputIterator  last 
) [inline]

Insert a range of elements before a given position in the Array.

Parameters:
position The position to insert the elements at. The insertion will be done before this position.
first The beginning of the range of elements to insert.
last The end of the range of elements to insert.

Definition at line 308 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

template<typename T>
void BLOCXX_NAMESPACE::Array< T >::insert ( size_type  position,
const T &  x 
) [inline]

Insert an element in the Array before an element specified by an index.

Parameters:
position An index that specifies where the element will be inserted.
x The element to insert into the Array.

Definition at line 279 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

template<typename T>
Array< T >::iterator BLOCXX_NAMESPACE::Array< T >::insert ( iterator  position,
const T &  x 
) [inline]

Insert an element in the Array before an element specified by an iterator.

Parameters:
position An iterator that points to the insertion point. The element will be inserted before this point.
x The element to insert into the Array.
Returns:
An iterator that points to the newly inserted element in the Array.

Definition at line 272 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

Referenced by BLOCXX_NAMESPACE::Array< T >::appendArray().

template<typename T >
Array< T >::size_type BLOCXX_NAMESPACE::Array< T >::max_size (  )  const [inline]
Returns:
The maximum number of elements the Array can hold.

Definition at line 167 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

template<typename T>
Array< T > & BLOCXX_NAMESPACE::Array< T >::operator+= ( const T &  x  )  [inline]

Append an object to the end of the Array.

Parameters:
x The object to append to the end of the Array.
Returns:
A reference to this Array object.

Definition at line 208 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

template<typename T >
Array< T >::const_reference BLOCXX_NAMESPACE::Array< T >::operator[] ( size_type  n  )  const [inline]

Retrieve A read only reference to an object in the Array at a given index.

Parameters:
n The index of the element to retrieve the reference for.
Returns:
A read only reference to the object at the given index.

Definition at line 198 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

template<typename T >
Array< T >::reference BLOCXX_NAMESPACE::Array< T >::operator[] ( size_type  n  )  [inline]

Retrieve A read/write reference to an object in the Array at a given index.

Parameters:
n The index of the element to retrieve the reference for.
Returns:
A read/write reference to the object at the given index.

Definition at line 188 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

template<typename T >
void BLOCXX_NAMESPACE::Array< T >::pop_back (  )  [inline]

Remove the last element of the Array.

Definition at line 322 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

Referenced by BLOCXX_NAMESPACE::Stack< T >::pop().

template<typename T>
void BLOCXX_NAMESPACE::Array< T >::push_back ( const T &  x  )  [inline]

Append an element to the end of the Array.

Parameters:
x The element to append to the end of the Array.

Definition at line 251 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

Referenced by BLOCXX_NAMESPACE::Array< T >::append(), BLOCXX_NAMESPACE::SocketBaseImpl::connect(), BLOCXX_NAMESPACE::StackTrace::getStackTrace(), and BLOCXX_NAMESPACE::Stack< T >::push().

template<typename T >
Array< T >::const_reverse_iterator BLOCXX_NAMESPACE::Array< T >::rbegin (  )  const [inline]
Returns:
A read only reverse iterator that points to the last element in the Array. Iteration is done in reverse order with the returned iterator.

Definition at line 139 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

template<typename T >
Array< T >::reverse_iterator BLOCXX_NAMESPACE::Array< T >::rbegin (  )  [inline]
Returns:
A read/write reverse iterator that points to the last element in the Array. Iteration is done in reverse order with the returned iterator.

Definition at line 132 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

template<typename T >
void BLOCXX_NAMESPACE::Array< T >::remove ( size_type  begin,
size_type  end 
) [inline]

Remove an element specified by a range.

Parameters:
begin An iterator that specifies the beginning of the range to remove.
end An iterator that specifies the end of the range to remove.

Definition at line 296 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

template<typename T >
void BLOCXX_NAMESPACE::Array< T >::remove ( size_type  index  )  [inline]

Remove an element from the Array at a given index.

Definition at line 286 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

template<typename T >
Array< T >::const_reverse_iterator BLOCXX_NAMESPACE::Array< T >::rend (  )  const [inline]
Returns:
A read only reverse iterator that points one before the first element of the Array. Iteration is done in reverse order with the returned iterator.

Definition at line 153 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

template<typename T >
Array< T >::reverse_iterator BLOCXX_NAMESPACE::Array< T >::rend (  )  [inline]
Returns:
A read/write reverse iterator that points one before the first element of the Array. Iteration is done in reverse order with the returned iterator.

Definition at line 146 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

template<typename T >
void BLOCXX_NAMESPACE::Array< T >::reserve ( size_type  n  )  [inline]

Ensure the capacity is at least the size of a given value.

If the given value is > max_size() the method with throw an std::length_error exception.

Parameters:
n - The minimum size this Array can be.

Definition at line 216 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

Referenced by BLOCXX_NAMESPACE::DelayedFormat::DelayedFormat().

template<typename T>
void BLOCXX_NAMESPACE::Array< T >::resize ( size_type  new_size  )  [inline]

Ensure the Array is a given size.

If the Array needs to be larger that what it already is, this method will append items that have been initialized using the default constructor of class T.

Parameters:
new_size The new size of the Array.

Definition at line 350 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

template<typename T>
void BLOCXX_NAMESPACE::Array< T >::resize ( size_type  new_size,
const T &  x 
) [inline]

Ensure the Array is a given size.

Parameters:
new_size The new size of the Array.
x An object to append to the end of the Array if it needs to be larger than what it already is.

Definition at line 343 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl.

template<typename T >
Array< T >::size_type BLOCXX_NAMESPACE::Array< T >::size (  )  const [inline]
template<typename T>
void BLOCXX_NAMESPACE::Array< T >::swap ( Array< T > &  x  )  [inline]

Swap the elements of this Array with the elements of another.

Parameters:
x The Array object this Array will swap elements with.

Definition at line 265 of file ArrayImpl.hpp.

References BLOCXX_NAMESPACE::Array< T >::m_impl, and BLOCXX_NAMESPACE::COWReference< T >::swap().

Referenced by BLOCXX_NAMESPACE::swap().


Friends And Related Function Documentation

template<class T>
bool operator< ( const Array< T > &  x,
const Array< T > &  y 
) [friend]

Determine if one Array is less than another.

This is done by doing a lexicographical compare on the Arrays. a lexicographical compare will compares the Arrays element by element until:

  • It finds two corresponding elements unequal, and the result of their comparison is taken as the result of the comparison between sequences.
  • No inequalities are found, but one sequence has more elements than the other, and the shorter sequence is considered less than the longer sequence.
  • No inequalities are found and the sequences have the same number of elements, and so the sequences are equal and the result of the comparison is false.
    Parameters:
    x The first Array object in the comparison.
    y The second Array object in the comparison.
    Returns:
    true if Array x is less than Array y.

Definition at line 439 of file ArrayImpl.hpp.

template<class T>
bool operator== ( const Array< T > &  x,
const Array< T > &  y 
) [friend]

Determine equality of two Arrays.

Two Arrays are considered equal if they are of the same size and elements in the same position are equal as defined by the “==” operator of the type in the Array.

Parameters:
x The first Array object in the comparison.
y The second Array object in the comparison.
Returns:
true if Array x is equal to Array y.

Definition at line 434 of file ArrayImpl.hpp.


Member Data Documentation

template<class T>
COWReference<V> BLOCXX_NAMESPACE::Array< T >::m_impl [private]

The documentation for this class was generated from the following files:
Generated on Mon Jul 5 19:59:38 2010 for blocxx by  doxygen 1.6.3