From c4cb01e3f0c62b22650ee6b5a3309a9463977031 Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Sun, 20 Aug 2023 13:43:48 +0200 Subject: [PATCH] Introduce SmartPointer::get() --- include/deal.II/base/smartpointer.h | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/include/deal.II/base/smartpointer.h b/include/deal.II/base/smartpointer.h index 798f3992c3..49dc336e79 100644 --- a/include/deal.II/base/smartpointer.h +++ b/include/deal.II/base/smartpointer.h @@ -152,8 +152,15 @@ public: operator*() const; /** - * Dereferencing operator. This operator throws an ExcNotInitializedi() if the - * pointer is a null pointer. + * Return underlying pointer. This operator throws an ExcNotInitialized() if + * the pointer is a null pointer. + */ + T * + get() const; + + /** + * Operator that returns the underlying pointer. This operator throws an + * ExcNotInitialized() if the pointer is a null pointer. */ T * operator->() const; @@ -378,7 +385,7 @@ SmartPointer::operator*() const template inline T * -SmartPointer::operator->() const +SmartPointer::get() const { Assert(t != nullptr, ExcNotInitialized()); Assert(pointed_to_object_is_alive, @@ -388,6 +395,15 @@ SmartPointer::operator->() const +template +inline T * +SmartPointer::operator->() const +{ + return this->get(); +} + + + template template inline void -- 2.39.5