From 4c06e5a8bdfec43454a50addb1ca0bb8e2bb6e9f Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 3 Sep 1998 16:01:47 +0000 Subject: [PATCH] Add #const# and add documentation. git-svn-id: https://svn.dealii.org/trunk@552 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/subscriptor.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/deal.II/base/include/base/subscriptor.h b/deal.II/base/include/base/subscriptor.h index 588bb2728b..5592ee007f 100644 --- a/deal.II/base/include/base/subscriptor.h +++ b/deal.II/base/include/base/subscriptor.h @@ -27,6 +27,9 @@ class Subscriptor * destruction it shall be zero again * (i.e. all objects which subscribed * should have unsubscribed again). + * + * The creator (and owner) of an object + * is not counted. */ mutable unsigned int counter; public: @@ -127,7 +130,7 @@ class SmartReference /** * Conversion to normal reference */ - operator T& () + operator T& () const { return t; } @@ -137,7 +140,12 @@ class SmartReference /** - * Smart pointers avoid destruction of an object in use. + * Smart pointers avoid destruction of an object in use. They can be used just + * like a pointer (i.e. using the #*# and #-># operators and through casting) + * but make sure that the object pointed to is not deleted in the course of + * use of the pointer by signalling the pointee its use. This is done using + * the #Subscriptor# class, which handles a use count and refuses destruction + * as long as a smart pointer or reference uses that object. */ template class SmartPointer -- 2.39.5