Refactor: BLI: Add MutableSpan::contains() function

Add `bool MutableSpan<T>::contains(const T &value)` function, which is an
exact copy of the function from the `Span<T>` class. This makes it possible
to call `.contains()` directly on the `MutableSpan`, instead of having to
call `.as_span()` first.

Note that the `contains_ptr()` function was already copied from `Span` to
`MutableSpan` before.

No functional changes to the affected code, just the removal of the now
no longer necessary `.to_span()` call.

Pull Request: https://projects.blender.org/blender/blender/pulls/131149
This commit is contained in:
Sybren A. Stüvel
2024-11-29 16:28:56 +01:00
parent 8504c12fa9
commit eaf596c49c
4 changed files with 28 additions and 2 deletions

View File

@@ -1364,7 +1364,7 @@ static int exec(bContext *C, wmOperator * /*op*/)
[&](const int i) { cyclic.span[i] = !cyclic.span[i]; });
cyclic.finish();
if (!cyclic.span.as_span().contains(true)) {
if (!cyclic.span.contains(true)) {
attributes.remove("cyclic");
}