]> https://gitweb.dealii.org/ - dealii.git/commitdiff
hp::Collection::CollectionIterator: give an exception a name.
authorDavid Wells <drwells@email.unc.edu>
Thu, 18 Jul 2024 13:30:04 +0000 (09:30 -0400)
committerDavid Wells <drwells@email.unc.edu>
Thu, 18 Jul 2024 13:31:08 +0000 (09:31 -0400)
include/deal.II/hp/collection.h

index a97b5f02315283c06d819879d23d793580191115..22781fea136b8ae872d439ab36c3c49e9a28a29e 100644 (file)
@@ -28,6 +28,16 @@ DEAL_II_NAMESPACE_OPEN
 
 namespace hp
 {
+  /**
+   * Exception thrown when comparing hp::Collection iterators into different
+   * objects.
+   *
+   * @ingroup Exceptions
+   */
+  DeclExceptionMsg(ExcDifferentCollection,
+                   "You are trying to compare iterators into different "
+                   "hp::Collection objects.");
+
   /**
    * An iterator for hp::Collection.
    */
@@ -64,10 +74,7 @@ namespace hp
     bool
     operator==(const CollectionIterator<T> &other) const
     {
-      Assert(
-        this->data == other.data,
-        ExcMessage(
-          "You are trying to compare iterators into different hp::Collection objects."));
+      Assert(this->data == other.data, ExcDifferentCollection());
       return this->index == other.index;
     }
 
@@ -77,10 +84,7 @@ namespace hp
     bool
     operator!=(const CollectionIterator<T> &other) const
     {
-      Assert(
-        this->data == other.data,
-        ExcMessage(
-          "You are trying to compare iterators into different hp::Collection objects."));
+      Assert(this->data == other.data, ExcDifferentCollection());
       return this->index != other.index;
     }
 

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.