C++20 Port #5

Merged
kayomn merged 35 commits from cpp-port into main 2023-02-20 02:33:45 +01:00
1 changed files with 2 additions and 3 deletions
Showing only changes of commit 3a9a6a34bb - Show all commits

View File

@ -70,8 +70,7 @@ export namespace core {
usize const updated_fill = this->filled + source_elements.length; usize const updated_fill = this->filled + source_elements.length;
if (updated_fill >= this->elements.length) { if (updated_fill >= this->elements.length) {
append_result const result = append_result const result = this->reserve(updated_fill);
this->reserve(max(this->elements.length, updated_fill));
if (result != append_result::ok) return result; if (result != append_result::ok) return result;
} }
@ -155,7 +154,7 @@ export namespace core {
* `initial_capacity` argument. * `initial_capacity` argument.
*/ */
append_result reserve(usize capacity) { append_result reserve(usize capacity) {
usize const requested_capacity = this->elements.length + capacity; usize const requested_capacity = this->filled + capacity;
if (this->is_dynamic()) { if (this->is_dynamic()) {
// Grow dynamic buffer (bailing out if failed). // Grow dynamic buffer (bailing out if failed).