From: Guido Kanschat Date: Thu, 30 Mar 2006 19:39:34 +0000 (+0000) Subject: add functions begin and end X-Git-Tag: v8.0.0~11941 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fea43f8352cdda0a2abf29cd435c16a82d256c9a;p=dealii.git add functions begin and end git-svn-id: https://svn.dealii.org/trunk@12779 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/base/include/base/vector_slice.h b/deal.II/base/include/base/vector_slice.h index 72c241a820..8ce98cdbee 100644 --- a/deal.II/base/include/base/vector_slice.h +++ b/deal.II/base/include/base/vector_slice.h @@ -86,6 +86,27 @@ class VectorSlice * std::vector. */ typename VECTOR::const_reference operator[] (unsigned int i) const; + + /** + * STL conforming iterator function. + */ + typename VECTOR::iterator begin(); + + /** + * STL conforming iterator function. + */ + typename VECTOR::const_iterator begin() const; + + /** + * STL conforming iterator function. + */ + typename VECTOR::iterator end(); + + /** + * STL conforming iterator function. + */ + typename VECTOR::const_iterator end() const; + private: /** * The vector we extract from. @@ -191,4 +212,40 @@ VectorSlice::operator[](unsigned int i) const } +template +inline +typename VECTOR::const_iterator +VectorSlice::begin() const +{ + return v.begin()+start; +} + + +template +inline +typename VECTOR::iterator +VectorSlice::begin() +{ + return v.begin()+start; +} + + +template +inline +typename VECTOR::const_iterator +VectorSlice::end() const +{ + return v.begin()+start+length; +} + + +template +inline +typename VECTOR::iterator +VectorSlice::end() +{ + return v.begin()+start+length; +} + + #endif