diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-03-17 22:22:29 +0100 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-03-17 22:31:15 +0100 |
| commit | 9ad3eafdfa46dc01d7a8737a59fe59caffd91d67 (patch) | |
| tree | 0779d9d331198419ff302c0a9cc0122366ed60f7 /libs | |
| parent | 1f8cc6683f4e2ef2e311078f48a1b4477dadaaec (diff) | |
| download | teachos-9ad3eafdfa46dc01d7a8737a59fe59caffd91d67.tar.xz teachos-9ad3eafdfa46dc01d7a8737a59fe59caffd91d67.zip | |
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.
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/kstd/include/kstd/vector | 6 |
1 files changed, 3 insertions, 3 deletions
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<value_type> 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; |
