mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-08 10:36:02 +00:00
AK: Add Span<T> constructor for arrays
The array constructor allows arrays to be easily treated as generic span of data.
This commit is contained in:
parent
3019445492
commit
21a959e29b
Notes:
sideshowbarker
2024-07-18 22:03:40 +09:00
Author: https://github.com/bgianfo
Commit: 21a959e29b
Pull-request: https://github.com/SerenityOS/serenity/pull/5448
Reviewed-by: https://github.com/awesomekling
1 changed files with 7 additions and 0 deletions
|
@ -46,6 +46,13 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<size_t size>
|
||||||
|
ALWAYS_INLINE constexpr Span(T (&values)[size])
|
||||||
|
: m_values(values)
|
||||||
|
, m_size(size)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
T* m_values { nullptr };
|
T* m_values { nullptr };
|
||||||
size_t m_size { 0 };
|
size_t m_size { 0 };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue