summaryrefslogtreecommitdiff
path: root/include/fud_vector.hpp
diff options
context:
space:
mode:
authorDominick Allen <djallen@librehumanitas.org>2024-11-10 15:14:54 -0600
committerDominick Allen <djallen@librehumanitas.org>2024-11-10 15:14:54 -0600
commit012df4bc38777c9053353ec2c4213bba67d63ab4 (patch)
tree4267c0cd4a7ed61119a44b31f0fc8b8adff2b4cf /include/fud_vector.hpp
parent1e89700693e92bb9c78ace739c71431b74d91e22 (diff)
Buffered file IO.
Diffstat (limited to 'include/fud_vector.hpp')
-rw-r--r--include/fud_vector.hpp7
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();