]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Explicitly =delete copy operators for TaskDescriptor. 9934/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 21 Apr 2020 15:49:03 +0000 (09:49 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Wed, 22 Apr 2020 13:52:41 +0000 (07:52 -0600)
include/deal.II/base/thread_management.h

index 4568730caad952c17a0566a3d8e4c63b30473628..73d40394db87f0f476577f4b26bd622f3e515c57 100644 (file)
@@ -1294,10 +1294,10 @@ namespace Threads
       TaskDescriptor();
 
       /**
-       * Copy constructor. Throws an exception since we want to make sure that
-       * each TaskDescriptor object corresponds to exactly one task.
+       * Copy constructor. Objects of this type can not be copied, and so this
+       * constructor is `delete`d and can't be called.
        */
-      TaskDescriptor(const TaskDescriptor &);
+      TaskDescriptor(const TaskDescriptor &) = delete;
 
       /**
        * Destructor.
@@ -1305,11 +1305,11 @@ namespace Threads
       ~TaskDescriptor();
 
       /**
-       * Copy operator. Throws an exception since we want to make sure that
-       * each TaskDescriptor object corresponds to exactly one task.
+       * Copy operator. Objects of this type can not be copied, and so this
+       * operator is `delete`d and can't be called.
        */
       TaskDescriptor &
-      operator=(const TaskDescriptor &);
+      operator=(const TaskDescriptor &) = delete;
 
       /**
        * Queue up the task to the scheduler. We need to do this in a separate
@@ -1371,17 +1371,6 @@ namespace Threads
 
 
 
-    template <typename RT>
-    TaskDescriptor<RT>::TaskDescriptor(const TaskDescriptor &)
-      : task_is_done(false)
-    {
-      // we shouldn't be getting here -- task descriptors
-      // can't be copied
-      Assert(false, ExcInternalError());
-    }
-
-
-
     template <typename RT>
     inline TaskDescriptor<RT>::~TaskDescriptor()
     {
@@ -1404,17 +1393,6 @@ namespace Threads
     }
 
 
-    template <typename RT>
-    TaskDescriptor<RT> &
-    TaskDescriptor<RT>::operator=(const TaskDescriptor &)
-    {
-      // we shouldn't be getting here -- task descriptors
-      // can't be copied
-      Assert(false, ExcInternalError());
-      return *this;
-    }
-
-
     template <typename RT>
     inline void
     TaskDescriptor<RT>::join()

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.