[ 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 >:

## Additional Inherited Members
Public Types inherited from ArrayVectorView< T >
typedef T | value_type
Public Member Functions inherited from ArrayVectorView< T >
| ArrayVectorView ()
| ArrayVectorView (size_type size, pointer const &data)
| ArrayVectorView (this_type const &rhs)
reference | back ()
const_reference | back () const
const_iterator | begin () const
iterator | begin ()
const_iterator | cbegin () const
const_iterator | cend () const
void | copy (this_type const &rhs)
template<class U >
void | copy (ArrayVectorView< U > const &rhs)
const_reverse_iterator | crbegin () const
const_reverse_iterator | crend () const
const_pointer | data () const
pointer | data ()
bool | empty () const
const_iterator | end () const
iterator | end ()
reference | front ()
const_reference | front () const
template<class U >
void | init (U const &initial)
bool | isInside (difference_type const &p) const
template<class U >
bool | operator!= (ArrayVectorView< U > const &rhs) const
ArrayVectorView & | operator= (ArrayVectorView const &rhs)
template<class U >
this_type & | operator= (ArrayVectorView< U > const &rhs)
template<class U >
bool | operator== (ArrayVectorView< U > const &rhs) const
reference | operator[] (difference_type i)
const_reference | operator[] (difference_type i) const
reverse_iterator | rbegin ()
const_reverse_iterator | rbegin () const
reverse_iterator | rend ()
const_reverse_iterator | rend () const
size_type | size () const
this_type | subarray (size_type begin, size_type end) const
void | swapData (this_type rhs)
template<class U >
void | swapData (ArrayVectorView< U > rhs)

## Detailed Description

### template<class T, class Alloc = std::allocator<T>>
class vigra::ArrayVector< T, Alloc >

Replacement for `std::vector`.

This template implements the same functionality as `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

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.11.0 (Fri May 19 2017)