mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:27:35 +00:00
AK: Implement Span which represents a contiguous sequence of objects.
This makes it possible to pass one object rather than pointer and length individually.
This commit is contained in:
parent
d43ddd6eb7
commit
ac9c2bc492
5 changed files with 277 additions and 8 deletions
|
@ -29,6 +29,7 @@
|
|||
#include <AK/Assertions.h>
|
||||
#include <AK/Forward.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/Span.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <AK/Traits.h>
|
||||
#include <AK/kmalloc.h>
|
||||
|
@ -186,6 +187,9 @@ public:
|
|||
m_size = other.size();
|
||||
}
|
||||
|
||||
Span<T> span() { return { data(), size() }; }
|
||||
Span<const T> span() const { return { data(), size() }; }
|
||||
|
||||
// FIXME: What about assigning from a vector with lower inline capacity?
|
||||
Vector& operator=(Vector&& other)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue