diff options
Diffstat (limited to 'source/blender/functions')
-rw-r--r-- | source/blender/functions/FN_generic_span.hh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/functions/FN_generic_span.hh b/source/blender/functions/FN_generic_span.hh index e2c49697ba9..6f0147b7fb3 100644 --- a/source/blender/functions/FN_generic_span.hh +++ b/source/blender/functions/FN_generic_span.hh @@ -93,6 +93,11 @@ class GSpan { const int64_t new_size = std::max<int64_t>(0, std::min(size, size_ - start)); return GSpan(*type_, POINTER_OFFSET(data_, type_->size() * start), new_size); } + + GSpan slice(const IndexRange range) const + { + return this->slice(range.start(), range.size()); + } }; /** @@ -169,6 +174,11 @@ class GMutableSpan { const int64_t new_size = std::max<int64_t>(0, std::min(size, size_ - start)); return GMutableSpan(*type_, POINTER_OFFSET(data_, type_->size() * start), new_size); } + + GMutableSpan slice(IndexRange range) const + { + return this->slice(range.start(), range.size()); + } }; } // namespace blender::fn |