A subscriptor can only be moved if there are no other objects
subscribing to it. This condition is already checked in a sensible
way in the destructor for Subscriptor, so rather than add a bunch
of boilerplate, the move constructor just invokes the destructor.
*/
Subscriptor(const Subscriptor &);
+#ifdef DEAL_II_WITH_CXX11
+ /**
+ * Move constructor.
+ *
+ * An object inheriting from Subscriptor can only be moved if no other
+ * objects are subscribing to it.
+ */
+ Subscriptor(Subscriptor&&);
+#endif
+
/**
* Destructor, asserting that the counter is zero.
*/
{}
+
+#ifdef DEAL_II_WITH_CXX11
+Subscriptor::Subscriptor (Subscriptor &&subscriptor)
+ :
+ counter(0),
+ object_info (subscriptor.object_info)
+{
+ // Explicitly invoke the destructor of `Subscriptor` for the object
+ // to be moved from in order to guarantee that we're not moving an
+ // object that has subscriptions.
+ subscriptor.~Subscriptor();
+}
+#endif
+
+
+
Subscriptor::~Subscriptor ()
{
// check whether there are still
// do_unsubscribe below that the
// object is unused now.
counter = 0;
+
+#ifdef DEAL_II_WITH_CXX11
+ object_info = nullptr;
+#else
+ object_info = 0;
+#endif
+
#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