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.
This commit is contained in:
Hans Goudey 2022-01-03 16:27:13 -06:00
parent 675d3cdd69
commit 9793bc30ce
1 changed files with 5 additions and 0 deletions

View File

@ -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.