mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 04:25:13 +00:00
AK: Add Span::first()
The missing sibling to Span::last()!
This commit is contained in:
parent
30b51b06b9
commit
668204041b
Notes:
sideshowbarker
2024-07-17 01:51:56 +09:00
Author: https://github.com/MacDue Commit: https://github.com/SerenityOS/serenity/commit/668204041b Pull-request: https://github.com/SerenityOS/serenity/pull/16938
1 changed files with 10 additions and 0 deletions
10
AK/Span.h
10
AK/Span.h
|
@ -212,6 +212,16 @@ public:
|
|||
return this->m_values[index];
|
||||
}
|
||||
|
||||
[[nodiscard]] ALWAYS_INLINE constexpr T const& first() const
|
||||
{
|
||||
return this->at(0);
|
||||
}
|
||||
|
||||
[[nodiscard]] ALWAYS_INLINE constexpr T& first()
|
||||
{
|
||||
return this->at(0);
|
||||
}
|
||||
|
||||
[[nodiscard]] ALWAYS_INLINE constexpr T const& last() const
|
||||
{
|
||||
return this->at(this->size() - 1);
|
||||
|
|
Loading…
Add table
Reference in a new issue