From 431b06716b9e9da8f828a30a30c40eb5585e197a Mon Sep 17 00:00:00 2001 From: Guido Kanschat Date: Fri, 4 Sep 1998 11:37:29 +0000 Subject: [PATCH] SmartPointer removed git-svn-id: https://svn.dealii.org/trunk@558 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/subscriptor.h | 76 ++----------------------- 1 file changed, 6 insertions(+), 70 deletions(-) diff --git a/deal.II/base/include/base/subscriptor.h b/deal.II/base/include/base/subscriptor.h index 85efd87440..e2c4482f3d 100644 --- a/deal.II/base/include/base/subscriptor.h +++ b/deal.II/base/include/base/subscriptor.h @@ -5,9 +5,9 @@ /*---------------------------- subscriptor.h ---------------------------*/ - +#ifndef __exceptions_H #include - +#endif /** @@ -102,7 +102,10 @@ class Subscriptor /** - * Smart references avoid destruction of a referenced object. + * Smart references avoid destruction of a referenced object. This + * class has not been fully developed, since the compiler could not + * resolve the dot operator in a convenient manner. The use of + * #SmartPointer# is recommended, instead. */ template class SmartReference @@ -139,73 +142,6 @@ class SmartReference -/** - * 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 -{ - T* t; - - public: - /** - * Constructor taking a normal pointer. - */ - SmartPointer(T* tt) - : t(tt) - { - t->subscribe(); - } - - /** - * Destructor, removing the subscription. - */ - ~SmartPointer() - { - t->unsubscribe(); - } - /** - * Assignment operator. Change of - * subscription is necessary. - */ - SmartPointer& operator=(T* tt) - { - t->unsubscribe(); - t = tt; - tt->subscribe(); - } - - - /** - * Conversion to normal pointer. - */ - operator T* () const - { - return t; - } - - /** - * Dereferencing operator. - */ - T& operator* () const - { - return *t; - } - - /** - * Dereferencing operator. - */ - T* operator -> () const - { - return t; - } -}; - -- 2.39.5