From 166133a496d548bddafb8087e11a68c4fac68e92 Mon Sep 17 00:00:00 2001 From: DennisOSRM Date: Thu, 22 Nov 2012 15:41:29 +0100 Subject: [PATCH] Setting size to zero after clear --- DataStructures/DeallocatingVector.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/DataStructures/DeallocatingVector.h b/DataStructures/DeallocatingVector.h index 997622c37..89502f7d4 100644 --- a/DataStructures/DeallocatingVector.h +++ b/DataStructures/DeallocatingVector.h @@ -135,7 +135,7 @@ public: mState.mIndex--; mState.setPointerForIndex(); return DeallocatingVectorIterator(_myState); } - + inline DeallocatingVectorIterator operator+(const difference_type& n) const { DeallocatingVectorIteratorState _myState(mState); _myState.mIndex+=n; _myState.setPointerForIndex(); @@ -217,11 +217,13 @@ public: //Delete[]'ing ptr's to all Buckets for(unsigned i = 0; i < mBucketList.size(); ++i) { if(DEALLOCATION_VECTOR_NULL_PTR != mBucketList[i]) { - delete[] (mBucketList[i]); + delete[] mBucketList[i]; + mBucketList[i] = DEALLOCATION_VECTOR_NULL_PTR; } } //Removing all ptrs from vector std::vector().swap(mBucketList); + mCurrentSize = 0; } inline void push_back(const ElementT & element) {