diff options
author | MacDue <macdue@dueutil.tech> | 2023-02-05 17:59:03 +0000 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-02-08 19:15:45 +0000 |
commit | 8483efb399faa961f26c3ff4273bf424e75a3157 (patch) | |
tree | acdc6969c4b6ed3ff9bb8dcb60ffe603c2e95e74 /AK | |
parent | b1793868b0e76dd39f7343c451178cf05ceca47b (diff) | |
download | serenity-8483efb399faa961f26c3ff4273bf424e75a3157.zip |
AK: Add ReadonlySpan<T> as an alias for Span<T const>
This is a little clearer than Span<T const> where it looks like it's
the T not the underlying array that's const.
Diffstat (limited to 'AK')
-rw-r--r-- | AK/Forward.h | 5 | ||||
-rw-r--r-- | AK/Span.h | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/AK/Forward.h b/AK/Forward.h index e258449ffd..3f67a9fd8a 100644 --- a/AK/Forward.h +++ b/AK/Forward.h @@ -61,7 +61,10 @@ struct Array; template<typename Container, typename ValueType> class SimpleIterator; -using ReadonlyBytes = Span<u8 const>; +template<typename T> +using ReadonlySpan = Span<T const>; + +using ReadonlyBytes = ReadonlySpan<u8>; using Bytes = Span<u8>; template<typename T, AK::MemoryOrder DefaultMemoryOrder> @@ -271,7 +271,10 @@ struct Traits<Span<T>> : public GenericTraits<Span<T>> { constexpr static bool is_trivial() { return true; } }; -using ReadonlyBytes = Span<u8 const>; +template<typename T> +using ReadonlySpan = Span<T const>; + +using ReadonlyBytes = ReadonlySpan<u8>; using Bytes = Span<u8>; } @@ -279,5 +282,6 @@ using Bytes = Span<u8>; #if USING_AK_GLOBALLY using AK::Bytes; using AK::ReadonlyBytes; +using AK::ReadonlySpan; using AK::Span; #endif |