AK: Add Span::first()

The missing sibling to Span::last()!
This commit is contained in:
MacDue 2023-01-09 23:30:12 +00:00 committed by Andreas Kling
parent 30b51b06b9
commit 668204041b

View file

@ -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);