From e5045f5959b78b6c3cf104166ce0dad63915fe37 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sun, 10 Sep 2023 10:20:03 -0600 Subject: [PATCH] Improve an error message in IndexSet::get_view(). --- source/base/index_set.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/base/index_set.cc b/source/base/index_set.cc index 383799cd9c..64c8b524d8 100644 --- a/source/base/index_set.cc +++ b/source/base/index_set.cc @@ -235,7 +235,13 @@ IndexSet::get_view(const size_type begin, const size_type end) const { Assert(begin <= end, ExcMessage("End index needs to be larger or equal to begin index!")); - Assert(end <= size(), ExcMessage("Given range exceeds index set dimension")); + Assert(end <= size(), + ExcMessage("You are asking for a view into an IndexSet object " + "that would cover the sub-range [" + + std::to_string(begin) + ',' + std::to_string(end) + + "). But this is not a subset of the range " + "of the current object, which is [0," + + std::to_string(size()) + ").")); IndexSet result(end - begin); std::vector::const_iterator r1 = ranges.begin(); -- 2.39.5