[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

| ArrayVector< T, Alloc > Class Template Reference |

`#include <vigra/array_vector.hxx>`

Inheritance diagram for ArrayVector< T, Alloc >:

List of all members.

## Public Types

typedef view_type::value_type | value_type

## Public Member Functions

template<class U >
this_type & | operator= (ArrayVectorView< U > const &rhs)

## Detailed Description

### template<class T, class Alloc>
class vigra::ArrayVector< T, Alloc >

Replacement for `std::vector`.

This template implements the same functionality as `a href="http://www.sgi.com/tech/stl/Vector.html">std::vector` (see there for detailed documentation). However, it gives two useful guarantees, that `std::vector` fails to provide:

- The memory is always allocated as one contiguous piece.
- The iterator is always a `T *`

This means that memory managed by `ArrayVector` can be passed to algorithms that expect raw memory. This is especially important when legacy or C code has to be called, but it is also useful for certain optimizations.

Moreover, `ArrayVector` is derived from `ArrayVectorView` so that one can create views of the array (in particular, subarrays). This implies another important difference to `std::vector`: the indexing operator (`ArrayVector::operator[]`) takes `signed` indices. In this way, an `ArrayVectorView` can be used with negative indices:

        ArrayVector<int> data(100);
        ArrayVectorView<int> view = data.subarray(50, 100);

        view[-50] = 1; // valid access

Refer to the documentation of `std::vector` for a detailed description of `ArrayVector` functionality.

#include <vigra/array_vector.hxx>
Namespace: vigra

## Member Typedef Documentation

typedef view_type::value_type value_type

default constructor

Reimplemented from ArrayVectorView< T >.

## Member Function Documentation

ArrayVector< T, Alloc > & operator= | ( | ArrayVectorView< U > const & | rhs | ) |

Copy assignment. When the shapes of the two arrays match, the array contents (not the pointers) are copied. Otherwise, a `PreconditionViolation` exception is thrown.

Reimplemented from ArrayVectorView< T >.

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

- vigra/array_vector.hxx

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany | html generated using doxygen and Python vigra 1.9.0 (Tue Nov 6 2012)