Skip to content

Commit

Permalink
AK: Add Span<T> constructor for arrays
Browse files Browse the repository at this point in the history
The array constructor allows arrays to be easily treated
as generic span of data.
  • Loading branch information
bgianfo authored and awesomekling committed Feb 21, 2021
1 parent 3019445 commit 21a959e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions AK/Span.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ class Span {
{
}

template<size_t size>
ALWAYS_INLINE constexpr Span(T (&values)[size])
: m_values(values)
, m_size(size)
{
}

protected:
T* m_values { nullptr };
size_t m_size { 0 };
Expand Down

0 comments on commit 21a959e

Please sign in to comment.