From 5222b8727e3c7431cd6194d084e71ae13ad94cec Mon Sep 17 00:00:00 2001 From: wolf Date: Tue, 8 Jun 1999 15:47:07 +0000 Subject: [PATCH] Add some code to make the copiler happier with unitialized data members and copy constructors, etc. git-svn-id: https://svn.dealii.org/trunk@1385 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/exceptions.h | 4 ++-- deal.II/base/include/base/smartpointer.h | 18 ++++++++++++++++++ deal.II/lac/include/lac/sparse_matrix.h | 9 +++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/deal.II/base/include/base/exceptions.h b/deal.II/base/include/base/exceptions.h index a3dc962787..8b5fb94b65 100644 --- a/deal.II/base/include/base/exceptions.h +++ b/deal.II/base/include/base/exceptions.h @@ -291,8 +291,8 @@ class ExceptionBase : public exception { * condition and the name of the exception as * a char pointer. */ - void SetFields (const char* f, - const int l, + void SetFields (const char *f, + const int l, const char *func, const char *c, const char *e); diff --git a/deal.II/base/include/base/smartpointer.h b/deal.II/base/include/base/smartpointer.h index d89f7cf9c6..c60294ec5d 100644 --- a/deal.II/base/include/base/smartpointer.h +++ b/deal.II/base/include/base/smartpointer.h @@ -47,6 +47,14 @@ class SmartPointer */ SmartPointer(); + /* + * Copy constructor for + * #SmartPointer#. We copy the object + * subscribed to from #tt#, but subscribe + * ourselves to it again. + */ + SmartPointer (const SmartPointer &tt); + /** * Constructor taking a normal pointer. * If possible, i.e. if the pointer @@ -125,6 +133,16 @@ SmartPointer::SmartPointer (T *t) : +template +SmartPointer::SmartPointer (const SmartPointer &tt) : + t (tt.t) +{ + if (t) + t->subscribe(); +}; + + + template SmartPointer::~SmartPointer () { if (t) diff --git a/deal.II/lac/include/lac/sparse_matrix.h b/deal.II/lac/include/lac/sparse_matrix.h index 9b7c83945b..7304fae8af 100644 --- a/deal.II/lac/include/lac/sparse_matrix.h +++ b/deal.II/lac/include/lac/sparse_matrix.h @@ -534,6 +534,15 @@ class SparseMatrixStruct : public Subscriptor * was called for this object. */ bool compressed; + + /** + * Copy operator. Declare but don't + * define it and make it private above + * that to avoid that anyone tries to + * use this operator. + */ + SparseMatrixStruct & operator = (const SparseMatrixStruct &); + template friend class SparseMatrix; }; -- 2.39.5