From 314fb1f68e04d90ef8d50ea05508b04e549b3d79 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Mon, 21 Mar 2011 14:43:52 +0000 Subject: [PATCH] Bug fix in copy and op=. Microsoft port --- .../containers/HashTables/HashPtrTable/HashPtrTable.C | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/OpenFOAM/containers/HashTables/HashPtrTable/HashPtrTable.C b/src/OpenFOAM/containers/HashTables/HashPtrTable/HashPtrTable.C index ab0d8f726..d4ee78d09 100644 --- a/src/OpenFOAM/containers/HashTables/HashPtrTable/HashPtrTable.C +++ b/src/OpenFOAM/containers/HashTables/HashPtrTable/HashPtrTable.C @@ -51,7 +51,8 @@ HashPtrTable::HashPtrTable(const HashPtrTable& ht) { for (const_iterator iter = ht.begin(); iter != ht.end(); ++iter) { - insert(iter.key(), new T(**iter)); + // Bug fix, Microsoft port. HJ, 21/Mar/2011 + insert(iter.key(), iter()->clone().ptr()); } } @@ -117,7 +118,10 @@ void HashPtrTable::clear() // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // template -void HashPtrTable::operator=(const HashPtrTable& ht) +void HashPtrTable::operator= +( + const HashPtrTable& ht +) { // Check for assignment to self if (this == &ht) @@ -134,7 +138,8 @@ void HashPtrTable::operator=(const HashPtrTable& ht) for(const_iterator iter = ht.begin(); iter != ht.end(); ++iter) { - insert(iter.key(), new T(**iter)); + // Bug fix, Microsoft port. HJ, 21/Mar/2011 + insert(iter.key(), iter()->clone().ptr()); } }