diff options
author | MacDue <macdue@dueutil.tech> | 2023-02-10 20:11:16 +0000 |
---|---|---|
committer | Jelle Raaijmakers <jelle@gmta.nl> | 2023-02-11 00:03:14 +0100 |
commit | c0b7ff3c4c61ff581f101482c7ce676f1e58d43d (patch) | |
tree | 95ab0e32faa4ebd9cabbc0e4151cd3662a107834 /AK/Vector.h | |
parent | e1b15b9a44d0fb1b436f5e6e9a38b85deaf4f3c4 (diff) | |
download | serenity-c0b7ff3c4c61ff581f101482c7ce676f1e58d43d.zip |
AK: Always initialize vector capacity to inline_capacity
This ensures constructors that take a span or an initializer_list
don't allocate when there's already enough inline storage.
(Previously these constructors always allocated)
Diffstat (limited to 'AK/Vector.h')
-rw-r--r-- | AK/Vector.h | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/AK/Vector.h b/AK/Vector.h index 35f7fb2f56..cb6a69830a 100644 --- a/AK/Vector.h +++ b/AK/Vector.h @@ -55,7 +55,6 @@ private: public: using ValueType = T; Vector() - : m_capacity(inline_capacity) { } @@ -833,7 +832,7 @@ private: StorageType& raw_at(size_t index) { return *slot(index); } size_t m_size { 0 }; - size_t m_capacity { 0 }; + size_t m_capacity { inline_capacity }; static constexpr size_t storage_size() { |