diff --git a/BAN/include/BAN/Vector.h b/BAN/include/BAN/Vector.h index 2e2e6db006..93636522b1 100644 --- a/BAN/include/BAN/Vector.h +++ b/BAN/include/BAN/Vector.h @@ -64,7 +64,7 @@ namespace BAN const T& front() const; T& front(); - ErrorOr resize(size_type); + ErrorOr resize(size_type, const T& = T()); ErrorOr reserve(size_type); ErrorOr shrink_to_fit(); @@ -297,7 +297,7 @@ namespace BAN } template - ErrorOr Vector::resize(size_type size) + ErrorOr Vector::resize(size_type size, const T& value) { TRY(ensure_capacity(size)); if (size < m_size) @@ -305,7 +305,7 @@ namespace BAN m_data[i].~T(); if (size > m_size) for (size_type i = m_size; i < size; i++) - new (m_data + i) T(); + new (m_data + i) T(value); m_size = size; return {}; }