0.12.0
Freundlich's C++ toolkit
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions
fcppt::container::grid::object< T, N, A > Class Template Reference

Detailed Description

template<typename T, fcppt::container::grid::size_type N, typename A>
class fcppt::container::grid::object< T, N, A >

A simple n dimensional array

See the module description for more information.

Public Types

typedef A allocator_type
 A type that represents the allocator class for the grid's storage.
 
typedef T value_type
 A type that represents the data type stored in a grid.
 
typedef A::size_type size_type
 A type that counts the number of elements in a grid.
 
typedef A::difference_type difference_type
 A type that provides the difference between the addresses of two elements in a grid.
 
typedef A::reference reference
 A type that provides a reference to an element stored in a grid.
 
typedef A::const_reference const_reference
 A type that provides a reference to a const element stored in a grid for reading and performing const operations.
 
typedef A::pointer pointer
 A type that provides a pointer to an element in a grid.
 
typedef A::const_pointer const_pointer
 A type that provides a pointer to a const element in a grid.
 
typedef container::iterator iterator
 A type that provides a random-access iterator that can read or modify any element in a grid.
 
typedef container::const_iterator const_iterator
 A type that provides a random-access iterator that can read a const element in a grid.
 
typedef container::reverse_iterator reverse_iterator
 A type that provides a random-access iterator that can read or modify any element in a reversed grid.
 
typedef
container::const_reverse_iterator 
const_reverse_iterator
 A type that provides a random-access iterator that can read any const element in the grid.
 
typedef grid::dim< size_type,
N >::type 
dim
 A type representing the dimension of the array.
 

Public Member Functions

 object ()
 An empty grid.
 
 object (dim const &d)
 The grid will have an initial size but the elements might not be initialized.
 
 object (dim const &d, const_reference r)
 Initialize the grid to a size and fill every cell with the same value.
 
template<typename In >
 object (dim const &d, In beg, In end)
 Constructs a grid from an iterator range.
 
 object (object const &)
 
objectoperator= (object const &)
 
 ~object ()
 
reference operator[] (dim const &)
 Returns a reference to the grid element at a specified position.
 
const_reference operator[] (dim const &) const
 Returns a reference to the grid element at a specified position.
 
reference at (dim const &)
 Returns a reference to the element at a specified location in the vector.
 
const_reference at (dim const &) const
 Returns a reference to the element at a specified location in the grid.
 
dim const & size () const
 Returns the grid's size.
 
size_type content () const
 Returns the number of elements in the grid.
 
bool empty () const
 Tests if the grid is empty.
 
void resize (dim const &d)
 Resizes the grid leaving its internal elements in an unspecific state.
 
void shrink_to_fit ()
 Tries to shrink capacity() to fit size()
 
pointer data ()
 Returns the pointer to the store.
 
const_pointer data () const
 Returns the pointer to the store.
 
pointer data_end ()
 Returns the pointer to the end of the store.
 
const_pointer data_end () const
 Returns the pointer to the end of the store.
 
iterator begin ()
 Returns a random-access iterator to the first element in the container.
 
const_iterator begin () const
 Returns a random-access iterator to the first element in the container.
 
const_iterator cbegin () const
 Returns a random-access const-iterator to the first element in the container.
 
iterator end ()
 Returns a random-access iterator that points just beyond the end of the grid.
 
const_iterator end () const
 Returns a random-access iterator that points just beyond the end of the grid.
 
const_iterator cend () const
 Returns a random-access const-iterator that points just beyond the end of the grid.
 
reverse_iterator rbegin ()
 Returns an iterator to the first element in a reversed grid.
 
const_reverse_iterator rbegin () const
 Returns an iterator to the first element in a reversed grid.
 
const_reverse_iterator crbegin () const
 Returns a const-iterator to the first element in a reversed grid.
 
reverse_iterator rend ()
 Returns an iterator to the end of a reversed grid.
 
const_reverse_iterator rend () const
 Returns an iterator to the end of a reversed grid.
 
const_reverse_iterator crend () const
 Returns an iterator to the end of a reversed grid.
 
void swap (object &)
 Exchanges the elements of two grids.
 

Member Typedef Documentation

template<typename T, fcppt::container::grid::size_type N, typename A>
typedef A fcppt::container::grid::object< T, N, A >::allocator_type

A type that represents the allocator class for the grid's storage.

template<typename T, fcppt::container::grid::size_type N, typename A>
typedef container::const_iterator fcppt::container::grid::object< T, N, A >::const_iterator

A type that provides a random-access iterator that can read a const element in a grid.

template<typename T, fcppt::container::grid::size_type N, typename A>
typedef A::const_pointer fcppt::container::grid::object< T, N, A >::const_pointer

A type that provides a pointer to a const element in a grid.

template<typename T, fcppt::container::grid::size_type N, typename A>
typedef A::const_reference fcppt::container::grid::object< T, N, A >::const_reference

A type that provides a reference to a const element stored in a grid for reading and performing const operations.

template<typename T, fcppt::container::grid::size_type N, typename A>
typedef container::const_reverse_iterator fcppt::container::grid::object< T, N, A >::const_reverse_iterator

A type that provides a random-access iterator that can read any const element in the grid.

template<typename T, fcppt::container::grid::size_type N, typename A>
typedef A::difference_type fcppt::container::grid::object< T, N, A >::difference_type

A type that provides the difference between the addresses of two elements in a grid.

template<typename T, fcppt::container::grid::size_type N, typename A>
typedef grid::dim< size_type, N >::type fcppt::container::grid::object< T, N, A >::dim

A type representing the dimension of the array.

template<typename T, fcppt::container::grid::size_type N, typename A>
typedef container::iterator fcppt::container::grid::object< T, N, A >::iterator

A type that provides a random-access iterator that can read or modify any element in a grid.

template<typename T, fcppt::container::grid::size_type N, typename A>
typedef A::pointer fcppt::container::grid::object< T, N, A >::pointer

A type that provides a pointer to an element in a grid.

template<typename T, fcppt::container::grid::size_type N, typename A>
typedef A::reference fcppt::container::grid::object< T, N, A >::reference

A type that provides a reference to an element stored in a grid.

template<typename T, fcppt::container::grid::size_type N, typename A>
typedef container::reverse_iterator fcppt::container::grid::object< T, N, A >::reverse_iterator

A type that provides a random-access iterator that can read or modify any element in a reversed grid.

template<typename T, fcppt::container::grid::size_type N, typename A>
typedef A::size_type fcppt::container::grid::object< T, N, A >::size_type

A type that counts the number of elements in a grid.

template<typename T, fcppt::container::grid::size_type N, typename A>
typedef T fcppt::container::grid::object< T, N, A >::value_type

A type that represents the data type stored in a grid.

Constructor & Destructor Documentation

template<typename T , fcppt::container::grid::size_type N, typename A >
object< T, N, A >::object ( )

An empty grid.

template<typename T , fcppt::container::grid::size_type N, typename A >
object< T, N, A >::object ( dim const &  d)
explicit

The grid will have an initial size but the elements might not be initialized.

Parameters
dThe initial size of the grid
template<typename T , fcppt::container::grid::size_type N, typename A >
object< T, N, A >::object ( dim const &  d,
const_reference  r 
)
explicit

Initialize the grid to a size and fill every cell with the same value.

Parameters
dThe size of the grid
rThe value to assign to each element of the grid
template<typename T , fcppt::container::grid::size_type N, typename A >
template<typename In >
object< T, N, A >::object ( dim const &  d,
In  beg,
In  end 
)
explicit

Constructs a grid from an iterator range.

Template Parameters
Aforward iterator type
Parameters
dThe size of the grid
begThe begining of the iterator range
endOne past the end of the iterator range
template<typename T , fcppt::container::grid::size_type N, typename A >
object< T, N, A >::object ( object< T, N, A > const &  _other)
template<typename T , fcppt::container::grid::size_type N, typename A >
object< T, N, A >::~object ( )

Member Function Documentation

template<typename T , fcppt::container::grid::size_type N, typename A >
fcppt::container::grid::object< T, N, A >::reference object< T, N, A >::at ( dim const &  _pos)

Returns a reference to the element at a specified location in the vector.

Exceptions
fcppt::container::out_of_range
template<typename T , fcppt::container::grid::size_type N, typename A >
fcppt::container::grid::object< T, N, A >::const_reference object< T, N, A >::at ( dim const &  _pos) const

Returns a reference to the element at a specified location in the grid.

Exceptions
fcppt::container::out_of_range
template<typename T , fcppt::container::grid::size_type N, typename A >
fcppt::container::grid::object< T, N, A >::iterator object< T, N, A >::begin ( )

Returns a random-access iterator to the first element in the container.

template<typename T , fcppt::container::grid::size_type N, typename A >
fcppt::container::grid::object< T, N, A >::const_iterator object< T, N, A >::begin ( ) const

Returns a random-access iterator to the first element in the container.

template<typename T , fcppt::container::grid::size_type N, typename A >
fcppt::container::grid::object< T, N, A >::const_iterator object< T, N, A >::cbegin ( ) const

Returns a random-access const-iterator to the first element in the container.

template<typename T , fcppt::container::grid::size_type N, typename A >
fcppt::container::grid::object< T, N, A >::const_iterator object< T, N, A >::cend ( ) const

Returns a random-access const-iterator that points just beyond the end of the grid.

template<typename T , fcppt::container::grid::size_type N, typename A >
fcppt::container::grid::object< T, N, A >::size_type object< T, N, A >::content ( ) const

Returns the number of elements in the grid.

template<typename T , fcppt::container::grid::size_type N, typename A >
fcppt::container::grid::object< T, N, A >::const_reverse_iterator object< T, N, A >::crbegin ( ) const

Returns a const-iterator to the first element in a reversed grid.

template<typename T , fcppt::container::grid::size_type N, typename A >
fcppt::container::grid::object< T, N, A >::const_reverse_iterator object< T, N, A >::crend ( ) const

Returns an iterator to the end of a reversed grid.

template<typename T , fcppt::container::grid::size_type N, typename A >
fcppt::container::grid::object< T, N, A >::pointer object< T, N, A >::data ( )

Returns the pointer to the store.

template<typename T , fcppt::container::grid::size_type N, typename A >
fcppt::container::grid::object< T, N, A >::const_pointer object< T, N, A >::data ( ) const

Returns the pointer to the store.

template<typename T , fcppt::container::grid::size_type N, typename A >
fcppt::container::grid::object< T, N, A >::pointer object< T, N, A >::data_end ( )

Returns the pointer to the end of the store.

Equal to data() + size().

template<typename T , fcppt::container::grid::size_type N, typename A >
fcppt::container::grid::object< T, N, A >::const_pointer object< T, N, A >::data_end ( ) const

Returns the pointer to the end of the store.

Equal to data() + size().

template<typename T , fcppt::container::grid::size_type N, typename A >
bool object< T, N, A >::empty ( ) const

Tests if the grid is empty.

template<typename T , fcppt::container::grid::size_type N, typename A >
fcppt::container::grid::object< T, N, A >::iterator object< T, N, A >::end ( )

Returns a random-access iterator that points just beyond the end of the grid.

template<typename T , fcppt::container::grid::size_type N, typename A >
fcppt::container::grid::object< T, N, A >::const_iterator object< T, N, A >::end ( ) const

Returns a random-access iterator that points just beyond the end of the grid.

template<typename T , fcppt::container::grid::size_type N, typename A >
fcppt::container::grid::object< T, N, A > & object< T, N, A >::operator= ( object< T, N, A > const &  _other)
template<typename T , fcppt::container::grid::size_type N, typename A >
fcppt::container::grid::object< T, N, A >::reference object< T, N, A >::operator[] ( dim const &  _pos)

Returns a reference to the grid element at a specified position.

template<typename T , fcppt::container::grid::size_type N, typename A >
fcppt::container::grid::object< T, N, A >::const_reference object< T, N, A >::operator[] ( dim const &  _pos) const

Returns a reference to the grid element at a specified position.

template<typename T , fcppt::container::grid::size_type N, typename A >
fcppt::container::grid::object< T, N, A >::reverse_iterator object< T, N, A >::rbegin ( )

Returns an iterator to the first element in a reversed grid.

template<typename T , fcppt::container::grid::size_type N, typename A >
fcppt::container::grid::object< T, N, A >::const_reverse_iterator object< T, N, A >::rbegin ( ) const

Returns an iterator to the first element in a reversed grid.

template<typename T , fcppt::container::grid::size_type N, typename A >
fcppt::container::grid::object< T, N, A >::reverse_iterator object< T, N, A >::rend ( )

Returns an iterator to the end of a reversed grid.

template<typename T , fcppt::container::grid::size_type N, typename A >
fcppt::container::grid::object< T, N, A >::const_reverse_iterator object< T, N, A >::rend ( ) const

Returns an iterator to the end of a reversed grid.

template<typename T , fcppt::container::grid::size_type N, typename A >
void object< T, N, A >::resize ( dim const &  d)

Resizes the grid leaving its internal elements in an unspecific state.

Parameters
dThe new dimensions of the grid
template<typename T , fcppt::container::grid::size_type N, typename A >
void object< T, N, A >::shrink_to_fit ( )

Tries to shrink capacity() to fit size()

template<typename T , fcppt::container::grid::size_type N, typename A >
fcppt::container::grid::object< T, N, A >::dim const & object< T, N, A >::size ( ) const

Returns the grid's size.

Warning
In contrast to the standard containers, this does not return a size_type value, but the dimension. Use content() to get the number of elements
template<typename T , fcppt::container::grid::size_type N, typename A >
void object< T, N, A >::swap ( object< T, N, A > &  _other)

Exchanges the elements of two grids.