From: Peter Munch Date: Sun, 20 Aug 2023 11:43:48 +0000 (+0200) Subject: Introduce SmartPointer::get() X-Git-Tag: relicensing~579^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c4cb01e3f0c62b22650ee6b5a3309a9463977031;p=dealii.git Introduce SmartPointer::get() --- 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