mirror of
https://github.com/SerenityOS/serenity.git
synced 2026-11-07 04:29:30 -10:00
AK: Add Array::in_reverse()
This commit is contained in:
1 parent
e56a0c603e
commit
f0a3ec9007
1 file changed
+12
+12
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <AK/Iterator.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/ReverseIterator.h>
|
||||
#include <AK/Span.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <AK/Tuple.h>
|
||||
@@ -112,12 +113,23 @@ struct Array {
|
||||
|
||||
using ConstIterator = SimpleIterator<Array const, T const>;
|
||||
using Iterator = SimpleIterator<Array, T>;
|
||||
using ReverseIterator = SimpleReverseIterator<Array, T>;
|
||||
using ReverseConstIterator = SimpleReverseIterator<Array const, T const>;
|
||||
|
||||
[[nodiscard]] constexpr ConstIterator begin() const { return ConstIterator::begin(*this); }
|
||||
[[nodiscard]] constexpr Iterator begin() { return Iterator::begin(*this); }
|
||||
[[nodiscard]] constexpr ReverseConstIterator rbegin() const { return ReverseConstIterator::rbegin(*this); }
|
||||
[[nodiscard]] constexpr ReverseIterator rbegin() { return ReverseIterator::rbegin(*this); }
|
||||
|
||||
[[nodiscard]] constexpr ConstIterator end() const { return ConstIterator::end(*this); }
|
||||
[[nodiscard]] constexpr Iterator end() { return Iterator::end(*this); }
|
||||
[[nodiscard]] constexpr ReverseConstIterator rend() const { return ReverseConstIterator::rend(*this); }
|
||||
[[nodiscard]] constexpr ReverseIterator rend() { return ReverseConstIterator::rend(*this); }
|
||||
|
||||
ALWAYS_INLINE constexpr auto in_reverse() const
|
||||
{
|
||||
return ReverseWrapper::in_reverse(*this);
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr operator ReadonlySpan<T>() const { return span(); }
|
||||
[[nodiscard]] constexpr operator Span<T>() { return span(); }
|
||||
|
||||
Reference in new issue
Block a user