From ffcbe6205b970ca89625d1aa92afe9d8cf03ad48 Mon Sep 17 00:00:00 2001 From: Sean Kim Date: Mon, 23 Jun 2025 17:57:59 +0200 Subject: [PATCH] BLI: Add assert for `indexed_data_equal` Typically, we use this function to determine whether or not a subset of data that has been collected with `gather` needs to be then persisted into a larger array with `scatter`. As such, it makes sense to assert on equality of the indices and smaller array size. Pull Request: https://projects.blender.org/blender/blender/pulls/140752 --- source/blender/blenlib/BLI_array_utils.hh | 1 + 1 file changed, 1 insertion(+) diff --git a/source/blender/blenlib/BLI_array_utils.hh b/source/blender/blenlib/BLI_array_utils.hh index d3f6260d6a8..eebaa88f4ec 100644 --- a/source/blender/blenlib/BLI_array_utils.hh +++ b/source/blender/blenlib/BLI_array_utils.hh @@ -326,6 +326,7 @@ template inline void fill_index_range(MutableSpan span, const T s template bool indexed_data_equal(const Span all_values, const Span indices, const Span values) { + BLI_assert(indices.size() == values.size()); for (const int i : indices.index_range()) { if (all_values[indices[i]] != values[i]) { return false;