aboutsummaryrefslogtreecommitdiff
path: root/libs/kstd
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-03-20 17:01:04 +0100
committerFelix Morgner <felix.morgner@ost.ch>2026-03-20 17:01:04 +0100
commitb430f23711071872ff054a1e1b30f8a028584fe4 (patch)
treee04a5cafa1bb9fe9b2fc6cc94810176c40f8be2f /libs/kstd
parentcb01bffde672cf7f4bec3a1c5b6383241181c960 (diff)
downloadteachos-b430f23711071872ff054a1e1b30f8a028584fe4.tar.xz
teachos-b430f23711071872ff054a1e1b30f8a028584fe4.zip
kstd/vector: optimize clear
Diffstat (limited to 'libs/kstd')
-rw-r--r--libs/kstd/include/kstd/vector6
1 files changed, 2 insertions, 4 deletions
diff --git a/libs/kstd/include/kstd/vector b/libs/kstd/include/kstd/vector
index 0a3d6b7..e4979e5 100644
--- a/libs/kstd/include/kstd/vector
+++ b/libs/kstd/include/kstd/vector
@@ -562,10 +562,8 @@ namespace kstd
//! Clear the contents of this vector.
constexpr auto clear() noexcept -> void
{
- for (auto i = m_size; i > 0; --i)
- {
- pop_back();
- }
+ destroy_n(begin(), size());
+ m_size = 0;
}
//! Append a given element to this vector via copy construction.