From: danshapero Date: Mon, 11 Apr 2016 23:16:58 +0000 (-0700) Subject: Added move assignment operator to Subscriptor X-Git-Tag: v8.5.0-rc1~1106^2~4 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ead45167d06f183a3631c56d978f441b8b904f1;p=dealii.git Added move assignment operator to Subscriptor --- diff --git a/include/deal.II/base/subscriptor.h b/include/deal.II/base/subscriptor.h index d4fd6d9df7..07b2d1e29c 100644 --- a/include/deal.II/base/subscriptor.h +++ b/include/deal.II/base/subscriptor.h @@ -92,6 +92,15 @@ public: */ Subscriptor &operator = (const Subscriptor &); +#ifdef DEAL_II_WITH_CXX11 + /** + * Move assignment operator. + * + * Asserts that the counter for the moved object is zero. + */ + Subscriptor &operator = (Subscriptor &&); +#endif + /** * Subscribes a user of the object. The subscriber may be identified by text * supplied as identifier. diff --git a/source/base/subscriptor.cc b/source/base/subscriptor.cc index 6fc9dde29d..fa2793aa2e 100644 --- a/source/base/subscriptor.cc +++ b/source/base/subscriptor.cc @@ -159,6 +159,16 @@ Subscriptor &Subscriptor::operator = (const Subscriptor &s) +#ifdef DEAL_II_WITH_CXX11 +Subscriptor &Subscriptor::operator = (Subscriptor &&s) +{ + s.check_no_subscribers(); + object_info = s.object_info; + return *this; +} +#endif + + void Subscriptor::subscribe(const char *id) const {