AK: Add Vector::unchecked_append for data pointers

This mirrors the existence of append() for data pointers and is very
useful when the program needs to have a guarantee of no allocations,
as is necessary for real-time audio.
This commit is contained in:
kleines Filmröllchen 2021-11-25 00:18:46 +01:00 committed by Brian Gianforcaro
parent 9c40311622
commit 05cb499d58

View file

@ -253,6 +253,15 @@ public:
++m_size;
}
ALWAYS_INLINE void unchecked_append(StorageType const* values, size_t count)
{
if (count == 0)
return;
VERIFY((size() + count) <= capacity());
TypedTransfer<StorageType>::copy(slot(m_size), values, count);
m_size += count;
}
template<class... Args>
void empend(Args&&... args) requires(!contains_reference)
{