From 433d62ec7ae782e4e0d14fdb03869b1b37fc9920 Mon Sep 17 00:00:00 2001 From: wolf Date: Tue, 17 Oct 2000 13:37:49 +0000 Subject: [PATCH] Make the SparseMatrix(SparsityPattern&) constructor explicit to avoid nasty bugs. git-svn-id: https://svn.dealii.org/trunk@3445 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/sparse_matrix.h | 36 ++++++++++++++++--------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/deal.II/lac/include/lac/sparse_matrix.h b/deal.II/lac/include/lac/sparse_matrix.h index 9fe43678a1..17b5e94e02 100644 --- a/deal.II/lac/include/lac/sparse_matrix.h +++ b/deal.II/lac/include/lac/sparse_matrix.h @@ -83,19 +83,31 @@ class SparseMatrix : public Subscriptor SparseMatrix (const SparseMatrix &); /** - * Constructor. Takes the given matrix - * sparsity structure to represent the - * sparsity pattern of this matrix. You - * can change the sparsity pattern later - * on by calling the @p{reinit} function. + * Constructor. Takes the given + * matrix sparsity structure to + * represent the sparsity pattern + * of this matrix. You can change + * the sparsity pattern later on + * by calling the @p{reinit} + * function. * - * You have to make sure that the lifetime - * of the sparsity structure is at least - * as long as that of this matrix or as - * long as @p{reinit} is not called with a - * new sparsity structure. - */ - SparseMatrix (const SparsityPattern &sparsity); + * You have to make sure that the + * lifetime of the sparsity + * structure is at least as long + * as that of this matrix or as + * long as @p{reinit} is not + * called with a new sparsity + * structure. + * + * The constructor is marked + * explicit so as to disallow + * that someone passes a sparsity + * pattern in place of a sparse + * matrix to some function, where + * an empty matrix would be + * generated then. + */ + explicit SparseMatrix (const SparsityPattern &sparsity); /** * Destructor. Free all memory, but do not -- 2.39.5