From 9ead45167d06f183a3631c56d978f441b8b904f1 Mon Sep 17 00:00:00 2001 From: danshapero Date: Mon, 11 Apr 2016 16:16:58 -0700 Subject: [PATCH] Added move assignment operator to Subscriptor --- include/deal.II/base/subscriptor.h | 9 +++++++++ source/base/subscriptor.cc | 10 ++++++++++ 2 files changed, 19 insertions(+) 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 { -- 2.39.5