]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Mark Subscriptor::check_no_subscribers as noexcept. 6379/head
authorDavid Wells <wellsd2@rpi.edu>
Sat, 28 Apr 2018 16:49:05 +0000 (12:49 -0400)
committerDavid Wells <wellsd2@rpi.edu>
Sat, 28 Apr 2018 17:16:48 +0000 (13:16 -0400)
Follow-up to a029a7f7acb7fe1a9bd30672b23da577af3c1932: since this function
should never throw we can mark it as noexcept.

This commit also updates relevant documentation explaining the present
behavior.

include/deal.II/base/subscriptor.h
source/base/subscriptor.cc

index 29f323de960f96ffb746f698accff0630f185d39..36679d27cde8da67c018386a3c55cb9b267038aa 100644 (file)
@@ -217,11 +217,19 @@ private:
   mutable const std::type_info *object_info;
 
   /**
-   * Check that there are no objects subscribing to this object and throw an
-   * error if there are, in order to guarantee that it is safe to either move
-   * or destroy this object.
+   * Check that there are no objects subscribing to this object. If this check
+   * passes then it is safe to destroy the current object. It this check fails
+   * then this function will either abort or print an error message to deallog
+   * (by using the AssertNothrow mechanism), but will not throw an exception.
+   *
+   * @note Since this function is just a consistency check it does nothing in
+   * release mode.
+   *
+   * @note If this function is called when there is an uncaught exception
+   * then, rather than aborting, this function prints an error message to the
+   * standard error stream and returns.
    */
-  void check_no_subscribers () const;
+  void check_no_subscribers () const noexcept;
 };
 
 //---------------------------------------------------------------------------
index 52c02feaf9c413ec89b5ef8bd3dd3ffb0d433430..e0a01df6c7d6a0baeebeacf77bae55faf6f9a727 100644 (file)
@@ -63,7 +63,7 @@ Subscriptor::~Subscriptor ()
 }
 
 
-void Subscriptor::check_no_subscribers () const
+void Subscriptor::check_no_subscribers () const noexcept
 {
   // Check whether there are still subscriptions to this object. If so, output
   // the actual name of the class to which this object belongs, i.e. the most
@@ -121,7 +121,6 @@ void Subscriptor::check_no_subscribers () const
                     << std::endl;
         }
     }
-
 #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.