]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Avoid unnecessary memory allocation. 13014/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Mon, 29 Nov 2021 22:37:36 +0000 (15:37 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Tue, 30 Nov 2021 16:59:49 +0000 (09:59 -0700)
include/deal.II/base/table.h
tests/base/aligned_vector_memory_02.output

index fadb1d0201d9faabb6d875e43b5b11883e670f2a..bfaa2bcdd3be8e5ce09d53fe2617ccae07a6aef2 100644 (file)
@@ -2154,10 +2154,9 @@ TableBase<N, T>::TableBase(const TableIndices<N> &sizes,
 template <int N, typename T>
 TableBase<N, T>::TableBase(const TableBase<N, T> &src)
   : Subscriptor()
-{
-  reinit(src.table_size, true);
-  values = src.values;
-}
+  , values(src.values)
+  , table_size(src.table_size)
+{}
 
 
 
index 81cb0618374c2e7e37892cb5679d31db4131ff8d..27b4034cd10919f3c3e5d1776dfe8b4746b6304c 100644 (file)
@@ -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

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.