Public Member Functions | |
| VectorSlice (VECTOR &v) | |
| VectorSlice (VECTOR &v, unsigned int start, unsigned int length) | |
| unsigned int | size () const |
| VECTOR::reference | operator[] (unsigned int i) |
| VECTOR::const_reference | operator[] (unsigned int i) const |
| VECTOR::iterator | begin () |
| VECTOR::const_iterator | begin () const |
| VECTOR::iterator | end () |
| VECTOR::const_iterator | end () const |
Private Attributes | |
| VECTOR & | v |
| const unsigned int | start |
| const unsigned int | length |
Related Functions | |
(Note that these are not member functions.) | |
| template<class VECTOR > | |
| const VectorSlice< const VECTOR > | make_slice (VECTOR &v) |
| template<class VECTOR > | |
| const VectorSlice< const VECTOR > | make_slice (VECTOR &v, const unsigned int start, const unsigned int length) |
Filter a range out of any object having a random access operator[] (unsigned int) and a function size() const.
The use of this object is straightforward. It duplicates the random access operator of the VECTOR and adds an offset to every index.
Some precautions have to be taken if it is used for a constant vector: the VectorSlice object has to be constant, too. The appropriate initalization sequence is like this:
void f(const std::vector<int>& v) { const VectorSlice<const std::vector<int> > slice(v,...); ... }
Definition at line 45 of file vector_slice.h.
| VectorSlice< VECTOR >::VectorSlice | ( | VECTOR & | v ) | [inline] |
Construct a vector slice containing the whole vector. Comes handy, if you did not want to have a slice at all, but the function you call wants it: just put in the vector itself as argument and let this constructor make a slice for you.
Definition at line 171 of file vector_slice.h.
| VectorSlice< VECTOR >::VectorSlice | ( | VECTOR & | v, |
| unsigned int | start, | ||
| unsigned int | length | ||
| ) | [inline] |
The real constructor for a vector slice, allowing you to specify the start index and the length of the slice.
Definition at line 179 of file vector_slice.h.
References Assert, and StandardExceptions::ExcIndexRange().
| unsigned int VectorSlice< VECTOR >::size | ( | ) | const [inline] |
Return the length of the slice using the same interface as std::vector.
Definition at line 193 of file vector_slice.h.
| VECTOR::reference VectorSlice< VECTOR >::operator[] | ( | unsigned int | i ) | [inline] |
Access an element of the slice using the same interface as std::vector.
Definition at line 202 of file vector_slice.h.
References Assert, and StandardExceptions::ExcIndexRange().
| VECTOR::const_reference VectorSlice< VECTOR >::operator[] | ( | unsigned int | i ) | const [inline] |
Access an element of a constant slice using the same interface as std::vector.
Definition at line 213 of file vector_slice.h.
References Assert, and StandardExceptions::ExcIndexRange().
| VECTOR::iterator VectorSlice< VECTOR >::begin | ( | ) | [inline] |
STL conforming iterator function.
Definition at line 233 of file vector_slice.h.
| VECTOR::const_iterator VectorSlice< VECTOR >::begin | ( | ) | const [inline] |
STL conforming iterator function.
Definition at line 224 of file vector_slice.h.
| VECTOR::iterator VectorSlice< VECTOR >::end | ( | ) | [inline] |
STL conforming iterator function.
Definition at line 251 of file vector_slice.h.
| VECTOR::const_iterator VectorSlice< VECTOR >::end | ( | ) | const [inline] |
STL conforming iterator function.
Definition at line 242 of file vector_slice.h.
| const VectorSlice< const VECTOR > make_slice | ( | VECTOR & | v ) | [related] |
Helper function for creating temporary objects without typing template arguments.
Definition at line 138 of file vector_slice.h.
| const VectorSlice< const VECTOR > make_slice | ( | VECTOR & | v, |
| const unsigned int | start, | ||
| const unsigned int | length | ||
| ) | [related] |
Helper function for creating temporary objects without typing template arguments.
Definition at line 156 of file vector_slice.h.
VECTOR& VectorSlice< VECTOR >::v [private] |
The vector we extract from.
Definition at line 116 of file vector_slice.h.
const unsigned int VectorSlice< VECTOR >::start [private] |
The start index of the slice.
Definition at line 120 of file vector_slice.h.
const unsigned int VectorSlice< VECTOR >::length [private] |
The length of the slice.
Definition at line 124 of file vector_slice.h.
documentation generated on Fri Feb 3 2012 06:04:13 by
doxygen
1.7.2