mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
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:
parent
9c40311622
commit
05cb499d58
Notes:
sideshowbarker
2024-07-18 05:37:06 +09:00
Author: https://github.com/kleinesfilmroellchen Commit: https://github.com/SerenityOS/serenity/commit/05cb499d58b Pull-request: https://github.com/SerenityOS/serenity/pull/10331 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/Hendiadyoin1 Reviewed-by: https://github.com/alimpfard
1 changed files with 9 additions and 0 deletions
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue