From 21a959e29bc3db0cea7a93d933d8b4a4978066be Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Sun, 21 Feb 2021 01:59:08 -0800 Subject: [PATCH] AK: Add Span constructor for arrays The array constructor allows arrays to be easily treated as generic span of data. --- AK/Span.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/AK/Span.h b/AK/Span.h index 6b5427656f..9890b6c144 100644 --- a/AK/Span.h +++ b/AK/Span.h @@ -46,6 +46,13 @@ public: { } + template + ALWAYS_INLINE constexpr Span(T (&values)[size]) + : m_values(values) + , m_size(size) + { + } + protected: T* m_values { nullptr }; size_t m_size { 0 };