From 45728dc818751cbb149b1b4abcf6ba152487ace3 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 29 Nov 2021 15:37:36 -0700 Subject: [PATCH] Avoid unnecessary memory allocation. --- include/deal.II/base/table.h | 7 +++---- tests/base/aligned_vector_memory_02.output | 10 ++++------ 2 files changed, 7 insertions(+), 10 deletions(-) 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 -- 2.39.5