array_proxy Class Template Reference
[Collections Library]

#include <stlsoft/collections/array_proxy.hpp>

Inheritance diagram for array_proxy:

stl_collection_tag collection_tag

List of all members.


Detailed Description

template<typename T>
class stlsoft::array_proxy< T >

Acts as a proxy for built-in arrays, ensuring functions passed array proxies have safe access to both array pointer and length.

Note:
This is described in detail in section 14.4 of Imperfect C++.

Attributes

pointer base ()
 Returns the base of the array.
pointer base () const
 Returns the base of the array.
size_type size () const
 Returns the number of elements in the sequence.
bool empty () const
 Indicates whether the search sequence is empty.
static size_type max_size ()
 Returns the maximum number of elements in the sequence.

Public Types

typedef T value_type
typedef array_proxy< T > class_type
typedef value_type * pointer
typedef value_type * const_pointer
typedef value_type * iterator
typedef value_type * const_iterator
typedef value_type & reference
typedef value_type & const_reference
typedef size_t size_type

Public Member Functions

Construction
template<typename D>
 array_proxy (array_proxy< D > &d)
 Conversion constructor, facilitating conversion between polymorphic types of the same size.
template<typename D, size_t N>
 array_proxy (D(&d)[N])
 Constructs an instance of the array proxy from the given array.
template<typename D>
 array_proxy (D *b, D *e)
 Constructs an instance of the array proxy from the given array.
template<typename D>
 array_proxy (D *p, size_t n)
 Constructs an instance of the array proxy from the given range.
Subscripting
reference operator[] (size_t index)
 Returns the element at the given index.
const_reference operator[] (size_t index) const
 Returns the element at the given index.
Iteration
iterator begin ()
 Begins the iteration.
iterator end ()
 Ends the iteration.
const_iterator begin () const
 Begins the iteration.
const_iterator end () const
 Ends the iteration.

Constructor & Destructor Documentation

array_proxy ( array_proxy< D > &  d  )  [inline]

Conversion constructor, facilitating conversion between polymorphic types of the same size.

Parameters:
d The array proxy of a derived type

array_proxy ( D(&)  d[N]  )  [inline, explicit]

Constructs an instance of the array proxy from the given array.

Parameters:
d The array

array_proxy ( D *  b,
D *  e 
) [inline]

Constructs an instance of the array proxy from the given array.

Parameters:
t The array Constructs an instance of the array proxy from the given range
begin The start point of the range [begin, end)
end The end point of the range [begin, end) Constructs an instance of the array proxy from the given range
b The start point of the range [begin, end)
e The end point of the range [begin, end)

array_proxy ( D *  p,
size_t  n 
) [inline]

Constructs an instance of the array proxy from the given range.

Parameters:
p The start of the range
n The number of elements in the range


Member Function Documentation

pointer base (  )  [inline]

Returns the base of the array.

pointer base (  )  const [inline]

Returns the base of the array.

size_type size (  )  const [inline]

Returns the number of elements in the sequence.

Referenced by array_proxy::operator[]().

bool empty (  )  const [inline]

Indicates whether the search sequence is empty.

static size_type max_size (  )  [inline, static]

Returns the maximum number of elements in the sequence.

reference operator[] ( size_t  index  )  [inline]

Returns the element at the given index.

Parameters:
index The offset of the requested element
Note:
No runtime checking of the validity of the index is provided in release builds, only a debug-time assert

References array_proxy::size(), and STLSOFT_MESSAGE_ASSERT.

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

Returns the element at the given index.

Parameters:
index The offset of the requested element
Note:
No runtime checking of the validity of the index is provided in release builds, only a debug-time assert

References array_proxy::size(), and STLSOFT_MESSAGE_ASSERT.

iterator begin (  )  [inline]

Begins the iteration.

Returns:
An iterator representing the start of the sequence

iterator end (  )  [inline]

Ends the iteration.

Returns:
An iterator representing the end of the sequence

const_iterator begin (  )  const [inline]

Begins the iteration.

Returns:
An iterator representing the start of the sequence

const_iterator end (  )  const [inline]

Ends the iteration.

Returns:
An iterator representing the end of the sequence


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

Generated on Thu Jun 10 08:58:39 2010 for STLSoft by  doxygen 1.5.6