]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
TableIndicesBase now has operators==/!=
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 28 Jul 2004 22:24:07 +0000 (22:24 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 28 Jul 2004 22:24:07 +0000 (22:24 +0000)
git-svn-id: https://svn.dealii.org/trunk@9532 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/include/base/table.h
deal.II/doc/news/c-5.0.html

index b1a17c19cf670e7dfe88ed07700ee113108f736d..515e990a9f7405c128b1679c6610ae7db6be8239 100644 (file)
@@ -50,7 +50,19 @@ template <typename T> class Table<6,T>;
                                         * <tt>i</tt>th index.
                                         */
       unsigned int operator[] (const unsigned int i) const;
-    
+
+                                      /**
+                                       * Compare two index fields for
+                                       * equality.
+                                       */
+      bool operator == (const TableIndicesBase<N> &other) const;
+
+                                      /**
+                                       * Compare two index fields for
+                                       * inequality.
+                                       */
+      bool operator != (const TableIndicesBase<N> &other) const;
+      
     protected:
                                        /**
                                         * Store the indices in an array.
@@ -1586,6 +1598,29 @@ TableIndicesBase<N>::operator [] (const unsigned int i) const
 
 
 
+template <int N>
+inline
+bool
+TableIndicesBase<N>::operator == (const TableIndicesBase<N> &other) const 
+{
+  for (unsigned int i=0; i<N; ++i)
+    if (indices[i] != other.indices[i])
+      return false;
+  return true;
+}
+
+
+
+template <int N>
+inline
+bool
+TableIndicesBase<N>::operator != (const TableIndicesBase<N> &other) const 
+{
+  return !(*this == other);
+}
+
+
+
 inline
 TableIndices<1>::TableIndices () 
 {
index 7217f5c5eec7541eedecc5b252b513e618542e63..ddb160dcb046b69438ebf23be05c8d17f9a03851 100644 (file)
@@ -75,6 +75,13 @@ inconvenience this causes.
 <h3>base</h3>
 
 <ol>
+  <li> <p>
+       New: Class <code class="class">TableIndices</code> now has
+       operators that check for equality and inequality of objects.
+       <br> 
+       (WB 2004/07/28)
+       </p>
+
   <li> <p>
        New: A class <code class="class">PointerComparison</code> for comparing
        pointers that may or may not be of the same type.

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.