From 8ba09c16a49f73c9fa00272c1327362331af922a Mon Sep 17 00:00:00 2001 From: guido Date: Mon, 23 May 2005 22:13:59 +0000 Subject: [PATCH] more documentation and members const git-svn-id: https://svn.dealii.org/trunk@10703 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/vector_slice.h | 49 ++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/deal.II/base/include/base/vector_slice.h b/deal.II/base/include/base/vector_slice.h index 98a0c852af..f16d894b8b 100644 --- a/deal.II/base/include/base/vector_slice.h +++ b/deal.II/base/include/base/vector_slice.h @@ -18,7 +18,7 @@ /** * Filter a range out of any object having a random access operator - * [] (unsigned int). + * [] (unsigned int) and a function size() const. * * The use of this object is straight forward. It reduplicates the * random access operator of the VECTOR and adds an offset to @@ -42,19 +42,62 @@ template class VectorSlice { public: + /** + * 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. + */ VectorSlice(VECTOR& v); + /** + * The real constructor for a + * vector slice, allowing you to + * specify the start index and + * the length of the slice. + */ VectorSlice(VECTOR& v, unsigned int start, unsigned int length); + /** + * Return the length of the slice + * using the same interface as + * std::vector. + */ unsigned int size() const; + /** + * Access an element of the slice + * using the same interface as + * std::vector. + */ typename VECTOR::reference operator[] (unsigned int); + + /** + * Access an element of a + * constant slice using the same + * interface as + * std::vector. + */ typename VECTOR::const_reference operator[] (unsigned int) const; private: + /** + * The vector we extract from. + */ VECTOR& v; - unsigned int start; - unsigned int length; + /** + * The start index of the slice. + */ + const unsigned int start; + /** + * The length of the slice. + */ + const unsigned int length; }; -- 2.39.5