mirror of
https://github.com/harfbuzz/harfbuzz.git
synced 2025-04-14 17:13:40 +00:00
[vector] Speed up shrink_vector for trivial destructors
This commit is contained in:
parent
da2e2c8c25
commit
0935b32795
1 changed files with 8 additions and 5 deletions
|
@ -351,11 +351,14 @@ struct hb_vector_t
|
|||
void
|
||||
shrink_vector (unsigned size)
|
||||
{
|
||||
while ((unsigned) length > size)
|
||||
{
|
||||
arrayZ[(unsigned) length - 1].~Type ();
|
||||
length--;
|
||||
}
|
||||
if (std::is_trivially_destructible<Type>::value)
|
||||
length = size;
|
||||
else
|
||||
while ((unsigned) length > size)
|
||||
{
|
||||
arrayZ[(unsigned) length - 1].~Type ();
|
||||
length--;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Add table
Reference in a new issue