]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Separate file for SmartReference
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 4 Sep 1998 14:37:07 +0000 (14:37 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 4 Sep 1998 14:37:07 +0000 (14:37 +0000)
git-svn-id: https://svn.dealii.org/trunk@567 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/include/base/smartreference.h [new file with mode: 0644]
deal.II/base/include/base/subscriptor.h

diff --git a/deal.II/base/include/base/smartreference.h b/deal.II/base/include/base/smartreference.h
new file mode 100644 (file)
index 0000000..0ffcc81
--- /dev/null
@@ -0,0 +1,50 @@
+/*----------------------------   smartreference.h     ---------------------------*/
+/*      $Id$                 */
+#ifndef __smartreference_H
+#define __smartreference_H
+/*----------------------------   smartreference.h     ---------------------------*/
+
+#include <base/subscriptor.h>
+
+/**
+ * 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 T>
+class SmartReference
+{
+    T& t;
+
+  public:
+                                    /**
+                                     * Constructor taking a normal reference.
+                                     */
+    SmartReference(const T& tt)
+                   : t(tt) 
+      {
+       t.subscribe();
+      }
+    
+                                    /**
+                                     * Destructor, removing the subscription.
+                                     */
+    ~SmartReference()
+      {
+       t.unsubscribe();
+      }
+  
+                                    /**
+                                     * Conversion to normal reference
+                                     */
+    operator T& () const
+      {
+       return t;
+      }
+};
+
+/*----------------------------   smartreference.h     ---------------------------*/
+/* end of #ifndef __smartreference_H */
+#endif
+/*----------------------------   smartreference.h     ---------------------------*/
index e2c4482f3d976373d0acc8663c9137e4be632977..34f780ba240a15869baccb50179bd3fd9cf8f9b0 100644 (file)
@@ -97,54 +97,6 @@ class Subscriptor
       }
 };
 
-
-
-
-
-/**
- * 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 T>
-class SmartReference
-{
-    T& t;
-
-  public:
-                                    /**
-                                     * Constructor taking a normal reference.
-                                     */
-    SmartReference(const T& tt)
-                   : t(tt) 
-      {
-       t.subscribe();
-      }
-    
-                                    /**
-                                     * Destructor, removing the subscription.
-                                     */
-    ~SmartReference()
-      {
-       t.unsubscribe();
-      }
-  
-                                    /**
-                                     * Conversion to normal reference
-                                     */
-    operator T& () const
-      {
-       return t;
-      }
-};
-
-
-
-
-
-
-
 /*----------------------------   subscriptor.h     ---------------------------*/
 /* end of #ifndef __subscriptor_H */
 #endif

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.