Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-01-04 01:27:13 +0300
committerHans Goudey <h.goudey@me.com>2022-01-04 01:27:13 +0300
commit9793bc30cec959cce7a23d3b75a772f39cc3d721 (patch)
treeb6fc2cfb7c5789fde46e935e1db3a8c5d8d00811
parent675d3cdd699d8c59cd886bcf5849e25002a69792 (diff)
BLI: Add slice method to MutableSpan
Span had a slice method with an IndexRange argument, but MutableSpan did not, yet. This commit makes the two types consistent.
-rw-r--r--source/blender/blenlib/BLI_span.hh5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_span.hh b/source/blender/blenlib/BLI_span.hh
index 5b7981e0302..995dc70a84d 100644
--- a/source/blender/blenlib/BLI_span.hh
+++ b/source/blender/blenlib/BLI_span.hh
@@ -599,6 +599,11 @@ template<typename T> class MutableSpan {
return MutableSpan(data_ + start, new_size);
}
+ constexpr MutableSpan slice(IndexRange range) const
+ {
+ return this->slice(range.start(), range.size());
+ }
+
/**
* Returns a new MutableSpan with n elements removed from the beginning. This invokes
* undefined behavior when n is negative.