From 4323e59ed4c666de500840bbcde4f625406d083f Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Tue, 2 Jun 2020 14:40:59 +0200 Subject: [PATCH] Further fixes for Remove function on UniquePtrList --- src/Memory/UniquePtrList.hpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Memory/UniquePtrList.hpp b/src/Memory/UniquePtrList.hpp index 10e2369..cdb4a58 100644 --- a/src/Memory/UniquePtrList.hpp +++ b/src/Memory/UniquePtrList.hpp @@ -42,7 +42,7 @@ namespace ArbUt { return _vector[index]; } - inline void Remove(size_t index){ + inline void Remove(size_t index) { #ifndef NO_ASSERT if (index >= _vector.size()) { std::stringstream ss; @@ -50,9 +50,8 @@ namespace ArbUt { throw std::logic_error(ss.str()); } #endif - auto item = _vector[index]; - delete item; - _vector.erase(item); + delete _vector[index]; + _vector.erase(_vector.begin() + index); } inline bool Contains(const BorrowedPtr& value) const {