mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 05:25:32 +03:00
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)
This commit is contained in:
parent
e1b15b9a44
commit
c0b7ff3c4c
Notes:
sideshowbarker
2024-07-17 00:32:25 +09:00
Author: https://github.com/MacDue Commit: https://github.com/SerenityOS/serenity/commit/c0b7ff3c4c Pull-request: https://github.com/SerenityOS/serenity/pull/17404 Reviewed-by: https://github.com/AtkinsSJ Reviewed-by: https://github.com/gmta ✅
@ -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()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user