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
This commit is contained in:
Sean Kim
2025-06-23 17:57:59 +02:00
committed by Sean Kim
parent 5790ff3b6a
commit ffcbe6205b

View File

@@ -326,6 +326,7 @@ template<typename T> inline void fill_index_range(MutableSpan<T> span, const T s
template<typename T>
bool indexed_data_equal(const Span<T> all_values, const Span<int> indices, const Span<T> values)
{
BLI_assert(indices.size() == values.size());
for (const int i : indices.index_range()) {
if (all_values[indices[i]] != values[i]) {
return false;