diff options
Diffstat (limited to 'include/fud_vector.hpp')
-rw-r--r-- | include/fud_vector.hpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/include/fud_vector.hpp b/include/fud_vector.hpp index a2a0984..9159770 100644 --- a/include/fud_vector.hpp +++ b/include/fud_vector.hpp @@ -120,7 +120,7 @@ class Vector { static Result<Vector<T>, FudStatus> withSize(size_t count, Allocator* allocator = &globalFudAllocator) { Vector<T> output{}; - auto status = initializeWithCapacity(output, count, allocator); + auto status = initializeWithSize(output, count, allocator); if (status != FudStatus::Success) { return FudError{status}; } @@ -402,7 +402,10 @@ class Vector { FudStatus clear() { if (m_allocator == nullptr || m_data == nullptr) { - return FudStatus::ObjectInvalid; + if (m_length > 0) { + return FudStatus::ObjectInvalid; + } + return FudStatus::Success; } for (size_t index = 0; index < m_length; ++index) { m_data[index].~T(); |