From 3374eac7412b784f412ec296f5eb5a5aab4a95eb Mon Sep 17 00:00:00 2001 From: EnderIce2 Date: Sat, 10 Feb 2024 05:17:03 +0200 Subject: [PATCH] Add resize(size_t, const T &) function to vector class --- include_std/vector | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include_std/vector b/include_std/vector index eadc8e1..b9bdd9d 100644 --- a/include_std/vector +++ b/include_std/vector @@ -285,6 +285,14 @@ namespace std this->VectorSize.store(Size); } + void resize(size_t count, const T &value) + { + reserve(count); + for (size_t i = this->VectorSize.load(); i < count; i++) + this->VectorBuffer[i] = value; + this->VectorSize.store(count); + } + void clear() { this->VectorCapacity.store(0);