mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:17:35 +00:00
AK: Add Span::first()
The missing sibling to Span::last()!
This commit is contained in:
parent
30b51b06b9
commit
668204041b
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];
|
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
|
[[nodiscard]] ALWAYS_INLINE constexpr T const& last() const
|
||||||
{
|
{
|
||||||
return this->at(this->size() - 1);
|
return this->at(this->size() - 1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue