BAN: Queue and Vector now default initialize newly allocated elements

This commit is contained in:
Bananymous 2023-01-13 00:56:38 +02:00
parent c35181a92f
commit 6ed542d6bf
2 changed files with 4 additions and 1 deletions

View File

@ -102,8 +102,9 @@ namespace BAN
memcpy(new_data, m_data, m_size * sizeof(T));
BAN::deallocator(m_data);
m_data = (T*)new_data;
for (size_type i = m_capacity; i < new_cap; i++)
m_data[i] = T();
m_capacity = new_cap;
return {};
}

View File

@ -215,6 +215,8 @@ namespace BAN
memcpy(new_data, m_data, m_size * sizeof(T));
BAN::deallocator(m_data);
m_data = (T*)new_data;
for (size_type i = m_capasity; i < new_cap; i++)
m_data[i] = T();
m_capasity = new_cap;
return {};
}