array_view Class Template Reference
[Collections Library]

#include <stlsoft/collections/array_view.hpp>

Inheritance diagram for array_view:

stl_collection_tag collection_tag

List of all members.


Detailed Description

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

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

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

Types
typedef T value_type
typedef array_view< T > class_type
typedef value_type * pointer
typedef value_type const * const_pointer
typedef value_type & reference
typedef value_type const & const_reference
typedef size_t size_type
typedef ss_ptrdiff_t difference_type
typedef value_type * iterator
 The iterator type.
typedef value_type const * const_iterator
 The non-mutable (const) iterator type.

Public Member Functions

Construction
 array_view ()
 Default constructor, creating a view of 0 size.
template<size_type N>
 array_view (T(&t)[N])
 Constructs an instance of the array view from the given array.
 array_view (pointer begin, pointer end)
 Constructs an instance of the array view from the given range.
 array_view (pointer p, size_type n)
 Constructs an instance of the array view from the given pointer.
void swap (class_type &rhs) throw ()
 Swaps the contents between this and rhs.
Subscripting
reference operator[] (size_type index)
 Returns the element at the given index.
const_reference operator[] (size_type index) const
 Returns the element at the given index.
reference at (size_type index)
 Returns the element at the given index.
const_reference at (size_type 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.

Member Typedef Documentation

typedef value_type* iterator

The iterator type.

typedef value_type const* const_iterator

The non-mutable (const) iterator type.


Constructor & Destructor Documentation

array_view (  )  [inline]

Default constructor, creating a view of 0 size.

Note:
The base() method returns NULL

References STLSOFT_ASSERT.

array_view ( T(&)  t[N]  )  [inline, explicit]

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

Parameters:
t The array

References STLSOFT_ASSERT.

array_view ( pointer  begin,
pointer  end 
) [inline]

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

Parameters:
begin The start point of the range [begin, end)
end The end point of the range [begin, end)

References STLSOFT_ASSERT.

array_view ( pointer  p,
size_type  n 
) [inline]

Constructs an instance of the array view from the given pointer.

Parameters:
p Pointer to the first element in the range
n The number of elements in the range

References STLSOFT_ASSERT.


Member Function Documentation

void swap ( class_type rhs  )  throw () [inline]

Swaps the contents between this and rhs.

References stlsoft::std_swap(), and STLSOFT_ASSERT.

pointer base (  )  [inline]

Returns the base of the array.

References STLSOFT_ASSERT.

pointer base (  )  const [inline]

Returns the base of the array.

References STLSOFT_ASSERT.

size_type size (  )  const [inline]

Returns the number of elements in the sequence.

References STLSOFT_ASSERT.

Referenced by array_view::end(), and array_view::operator[]().

bool empty (  )  const [inline]

Indicates whether the search sequence is empty.

References STLSOFT_ASSERT.

static size_type max_size (  )  [inline, static]

Returns the maximum number of elements in the sequence.

reference operator[] ( size_type  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_view::size(), STLSOFT_ASSERT, and STLSOFT_MESSAGE_ASSERT.

const_reference operator[] ( size_type  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_view::size(), STLSOFT_ASSERT, and STLSOFT_MESSAGE_ASSERT.

reference at ( size_type  index  )  [inline]

Returns the element at the given index.

Parameters:
index The offset of the requested element
Note:
Throws an instance of std::out_of_range if the index is not < size()

References STLSOFT_ASSERT.

const_reference at ( size_type  index  )  const [inline]

Returns the element at the given index.

Parameters:
index The offset of the requested element
Note:
Throws an instance of std::out_of_range if the index is not < size()

References STLSOFT_ASSERT.

iterator begin (  )  [inline]

Begins the iteration.

Returns:
An iterator representing the start of the sequence

References STLSOFT_ASSERT.

Referenced by array_view::end().

iterator end (  )  [inline]

Ends the iteration.

Returns:
An iterator representing the end of the sequence

References array_view::begin(), array_view::size(), and STLSOFT_ASSERT.

const_iterator begin (  )  const [inline]

Begins the iteration.

Returns:
An iterator representing the start of the sequence

References STLSOFT_ASSERT.

const_iterator end (  )  const [inline]

Ends the iteration.

Returns:
An iterator representing the end of the sequence

References array_view::begin(), array_view::size(), and STLSOFT_ASSERT.


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