From be7654056ae98f3841220236484ff053be05afc3 Mon Sep 17 00:00:00 2001 From: David Wells Date: Mon, 28 Jan 2019 16:51:31 -0500 Subject: [PATCH] Mark a few Subscriptor functions as inline. These are simple enough that they should live in the header. This will allow classes inheriting from Subscriptor to potentially inline some more constructors too. --- include/deal.II/base/subscriptor.h | 31 +++++++++++++++++++++++++++ source/base/subscriptor.cc | 34 ------------------------------ 2 files changed, 31 insertions(+), 34 deletions(-) diff --git a/include/deal.II/base/subscriptor.h b/include/deal.II/base/subscriptor.h index f59d182839..431f8c03e4 100644 --- a/include/deal.II/base/subscriptor.h +++ b/include/deal.II/base/subscriptor.h @@ -290,6 +290,37 @@ private: //--------------------------------------------------------------------------- +inline Subscriptor::Subscriptor() + : counter(0) + , object_info(nullptr) +{} + + + +inline Subscriptor::Subscriptor(const Subscriptor &) + : counter(0) + , object_info(nullptr) +{} + + + +inline Subscriptor & +Subscriptor::operator=(const Subscriptor &s) +{ + object_info = s.object_info; + return *this; +} + + + +inline unsigned int +Subscriptor::n_subscriptions() const +{ + return counter; +} + + + template inline void Subscriptor::serialize(Archive &, const unsigned int) diff --git a/source/base/subscriptor.cc b/source/base/subscriptor.cc index aeac2c0807..669f71b909 100644 --- a/source/base/subscriptor.cc +++ b/source/base/subscriptor.cc @@ -31,23 +31,6 @@ static const char *unknown_subscriber = "unknown subscriber"; std::mutex Subscriptor::mutex; -Subscriptor::Subscriptor() - : counter(0) - , object_info(nullptr) -{ - // this has to go somewhere to avoid an extra warning. - (void)unknown_subscriber; -} - - - -Subscriptor::Subscriptor(const Subscriptor &) - : counter(0) - , object_info(nullptr) -{} - - - Subscriptor::Subscriptor(Subscriptor &&subscriptor) noexcept : counter(0) , object_info(subscriptor.object_info) @@ -132,15 +115,6 @@ Subscriptor::check_no_subscribers() const noexcept -Subscriptor & -Subscriptor::operator=(const Subscriptor &s) -{ - object_info = s.object_info; - return *this; -} - - - Subscriptor & Subscriptor::operator=(Subscriptor &&s) noexcept { @@ -224,14 +198,6 @@ Subscriptor::unsubscribe(std::atomic *const validity, -unsigned int -Subscriptor::n_subscriptions() const -{ - return counter; -} - - - void Subscriptor::list_subscribers() const { -- 2.39.5