mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
AK: Add a way to slice from the end of a span
This commit is contained in:
parent
477ab6dc4c
commit
c022b6d74e
Notes:
sideshowbarker
2024-07-18 17:19:31 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/c022b6d74ec Pull-request: https://github.com/SerenityOS/serenity/pull/7482 Reviewed-by: https://github.com/ADKaster
1 changed files with 5 additions and 0 deletions
|
@ -128,6 +128,11 @@ public:
|
|||
VERIFY(start <= size());
|
||||
return { this->m_values + start, size() - start };
|
||||
}
|
||||
[[nodiscard]] ALWAYS_INLINE constexpr Span slice_from_end(size_t count) const
|
||||
{
|
||||
VERIFY(count <= size());
|
||||
return { this->m_values + size() - count, count };
|
||||
}
|
||||
|
||||
[[nodiscard]] ALWAYS_INLINE constexpr Span trim(size_t length) const
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue