From fe523f6c0d9d68e0bb3b49a56db507f0956f4568 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sat, 17 Apr 2021 14:49:29 +0200 Subject: [PATCH] Show actual length when logging out of bounds errors on lists. --- src/Collections/List.hpp | 6 +++--- src/Memory/__OptionalUniquePtrList.hpp | 4 ++-- src/Memory/__UniquePtrList.hpp | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Collections/List.hpp b/src/Collections/List.hpp index 1cc59df..a87bcda 100644 --- a/src/Collections/List.hpp +++ b/src/Collections/List.hpp @@ -35,7 +35,7 @@ namespace ArbUt { #ifndef NO_ASSERT if (index >= _vector.size()) { std::stringstream ss; - ss << "Index " << index << " is out of bounds."; + ss << "Index " << index << " is out of bounds for length: " << _vector.size(); throw ArbUt::Exception(ss.str()); } #endif @@ -49,7 +49,7 @@ namespace ArbUt { #ifndef NO_ASSERT if (index >= _vector.size()) { std::stringstream ss; - ss << "Index " << index << " is out of bounds."; + ss << "Index " << index << " is out of bounds for length: " << _vector.size(); throw ArbUt::Exception(ss.str()); } #endif @@ -64,7 +64,7 @@ namespace ArbUt { #ifndef NO_ASSERT if (index >= _vector.size()) { std::stringstream ss; - ss << "Index " << index << " is out of bounds."; + ss << "Index " << index << " is out of bounds for length: " << _vector.size(); throw ArbUt::Exception(ss.str()); } #endif diff --git a/src/Memory/__OptionalUniquePtrList.hpp b/src/Memory/__OptionalUniquePtrList.hpp index f6ca1a8..2da5a6c 100644 --- a/src/Memory/__OptionalUniquePtrList.hpp +++ b/src/Memory/__OptionalUniquePtrList.hpp @@ -48,7 +48,7 @@ namespace ArbUt { #ifndef NO_ASSERT if (index >= _vector.size()) { std::stringstream ss; - ss << "Index " << index << " is out of bounds."; + ss << "Index " << index << " is out of bounds for length: " << _vector.size(); throw ArbUt::Exception(ss.str()); } #endif @@ -86,7 +86,7 @@ namespace ArbUt { #ifndef NO_ASSERT if (index >= _vector.size()) { std::stringstream ss; - ss << "Index " << index << " is out of bounds."; + ss << "Index " << index << " is out of bounds for length: " << _vector.size(); throw ArbUt::Exception(ss.str()); } #endif diff --git a/src/Memory/__UniquePtrList.hpp b/src/Memory/__UniquePtrList.hpp index 1322488..cb6555e 100644 --- a/src/Memory/__UniquePtrList.hpp +++ b/src/Memory/__UniquePtrList.hpp @@ -53,7 +53,7 @@ namespace ArbUt { #ifndef NO_ASSERT if (index >= _vector.size()) { std::stringstream ss; - ss << "Index " << index << " is out of bounds."; + ss << "Index " << index << " is out of bounds for length: " << _vector.size(); throw ArbUt::Exception(ss.str()); } #endif @@ -92,7 +92,7 @@ namespace ArbUt { #ifndef NO_ASSERT if (index >= _vector.size()) { std::stringstream ss; - ss << "Index " << index << " is out of bounds."; + ss << "Index " << index << " is out of bounds for length: " << _vector.size(); throw ArbUt::Exception(ss.str()); } #endif