From: Wolfgang Bangerth Date: Mon, 29 Nov 2021 22:37:36 +0000 (-0700) Subject: Avoid unnecessary memory allocation. X-Git-Tag: v9.4.0-rc1~777^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=45728dc818751cbb149b1b4abcf6ba152487ace3;p=dealii.git Avoid unnecessary memory allocation. --- diff --git a/include/deal.II/base/table.h b/include/deal.II/base/table.h index fadb1d0201..bfaa2bcdd3 100644 --- a/include/deal.II/base/table.h +++ b/include/deal.II/base/table.h @@ -2154,10 +2154,9 @@ TableBase::TableBase(const TableIndices &sizes, template TableBase::TableBase(const TableBase &src) : Subscriptor() -{ - reinit(src.table_size, true); - values = src.values; -} + , values(src.values) + , table_size(src.table_size) +{} diff --git a/tests/base/aligned_vector_memory_02.output b/tests/base/aligned_vector_memory_02.output index 81cb061837..27b4034cd1 100644 --- a/tests/base/aligned_vector_memory_02.output +++ b/tests/base/aligned_vector_memory_02.output @@ -2,12 +2,10 @@ DEAL::---- Creating outer table DEAL::default constructor. Object number 0 DEAL::---- Cloning outer table -DEAL::default constructor. Object number 1 -DEAL::destructor. Object number 1 -DEAL::copy constructor from 0. Object number 2 +DEAL::copy constructor from 0. Object number 1 DEAL::---- Destroying the clone -DEAL::destructor. Object number 2 +DEAL::destructor. Object number 1 DEAL::---- Destroying the source table DEAL::destructor. Object number 0 -DEAL::Objects created: 3 -DEAL::Objects destroyed: 3 +DEAL::Objects created: 2 +DEAL::Objects destroyed: 2