From 9ad3eafdfa46dc01d7a8737a59fe59caffd91d67 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Tue, 17 Mar 2026 22:22:29 +0100 Subject: kstd: fix constructor selection in vector The old version would lead to potential issues, since an explicit ctor may get selected. Ideally vector should be adapted to not allocated an array of it's value type but simply suitably aligned raw storage. --- libs/kstd/include/kstd/vector | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libs/kstd') diff --git a/libs/kstd/include/kstd/vector b/libs/kstd/include/kstd/vector index 7568cb6..41b380e 100644 --- a/libs/kstd/include/kstd/vector +++ b/libs/kstd/include/kstd/vector @@ -85,7 +85,7 @@ namespace kstd vector(vector const & other) : _size(other._size) , _capacity(other._capacity) - , _data(new value_type[_capacity]{}) + , _data(new value_type[_capacity]()) { std::ranges::copy(other, _data); } @@ -104,7 +104,7 @@ namespace kstd delete[] _data; _size = other._size; _capacity = other._capacity; - _data = new value_type[_capacity]{}; + _data = new value_type[_capacity](); std::ranges::copy(other, _data); return *this; } @@ -490,7 +490,7 @@ namespace kstd } _capacity = new_capacity; - auto temp = new value_type[_capacity]{}; + auto temp = new value_type[_capacity](); std::ranges::copy(begin(), end(), temp); delete[] _data; _data = temp; -- cgit v1.2.3