AK: Add slice() overload to Span.
This commit is contained in:
parent
36080c5964
commit
525d51bbb5
Notes:
sideshowbarker
2024-07-19 03:35:01 +09:00
Author: https://github.com/asynts Commit: https://github.com/SerenityOS/serenity/commit/525d51bbb52 Pull-request: https://github.com/SerenityOS/serenity/pull/3166 Reviewed-by: https://github.com/nico
1 changed files with 6 additions and 0 deletions
|
@ -148,6 +148,12 @@ public:
|
|||
return { this->m_values + start, size };
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Span slice(size_t start) const
|
||||
{
|
||||
ASSERT(start < this->m_size);
|
||||
return { this->m_values + start, this->m_size - start };
|
||||
}
|
||||
|
||||
ALWAYS_INLINE T* offset(size_t start) const
|
||||
{
|
||||
ASSERT(start < this->m_size);
|
||||
|
|
Loading…
Add table
Reference in a new issue