]> https://gitweb.dealii.org/ - dealii.git/commitdiff
add functions begin and end
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Thu, 30 Mar 2006 19:39:34 +0000 (19:39 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Thu, 30 Mar 2006 19:39:34 +0000 (19:39 +0000)
git-svn-id: https://svn.dealii.org/trunk@12779 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/include/base/vector_slice.h

index 72c241a820092fee850489375d2ab01643264f1a..8ce98cdbee22276f794c9863a9e330503b950dd2 100644 (file)
@@ -86,6 +86,27 @@ class VectorSlice
                                      * <tt>std::vector</tt>.
                                      */
     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<VECTOR>::operator[](unsigned int i) const
 }
 
 
+template <class VECTOR>
+inline
+typename VECTOR::const_iterator
+VectorSlice<VECTOR>::begin() const
+{
+  return v.begin()+start;
+}
+
+
+template <class VECTOR>
+inline
+typename VECTOR::iterator
+VectorSlice<VECTOR>::begin()
+{
+  return v.begin()+start;
+}
+
+
+template <class VECTOR>
+inline
+typename VECTOR::const_iterator
+VectorSlice<VECTOR>::end() const
+{
+  return v.begin()+start+length;
+}
+
+
+template <class VECTOR>
+inline
+typename VECTOR::iterator
+VectorSlice<VECTOR>::end()
+{
+  return v.begin()+start+length;
+}
+
+
 #endif

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.