common array: enhance the features.

Add a push() method that appends a whole array instance.
This commit is contained in:
Hermet Park 2023-07-17 15:45:27 +09:00 committed by Hermet Park
parent d53d8d726f
commit 192d29fa8a

View file

@ -52,6 +52,13 @@ struct Array
data[count++] = element;
}
void push(Array<T>& rhs)
{
grow(rhs.count);
memcpy(data + count, rhs.data, rhs.count * sizeof(T));
count += rhs.count;
}
bool reserve(uint32_t size)
{
if (size > reserved) {