diff options
author | Hans Goudey <h.goudey@me.com> | 2022-01-04 01:27:13 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-01-04 01:27:13 +0300 |
commit | 9793bc30cec959cce7a23d3b75a772f39cc3d721 (patch) | |
tree | b6fc2cfb7c5789fde46e935e1db3a8c5d8d00811 /source/blender/blenlib | |
parent | 675d3cdd699d8c59cd886bcf5849e25002a69792 (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.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_span.hh | 5 |
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. |