mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:57:45 +00:00
AK: Allow creating a Vector from any Span of the same underlying type
This allows, for example, to create a Vector from a subset of another Vector.
This commit is contained in:
parent
5bb00a75f5
commit
c12cfe83b7
1 changed files with 7 additions and 0 deletions
|
@ -91,6 +91,13 @@ public:
|
|||
m_size = other.size();
|
||||
}
|
||||
|
||||
explicit Vector(Span<T const> other) requires(!IsLvalueReference<T>)
|
||||
{
|
||||
ensure_capacity(other.size());
|
||||
TypedTransfer<StorageType>::copy(data(), other.data(), other.size());
|
||||
m_size = other.size();
|
||||
}
|
||||
|
||||
template<size_t other_inline_capacity>
|
||||
Vector(Vector<T, other_inline_capacity> const& other)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue