[vector] Optimize shrink_vector for size
Compiler is smarter than I am.
This commit is contained in:
parent
bc8eded296
commit
d36f688131
|
@ -235,10 +235,8 @@ struct hb_vector_t
|
||||||
{
|
{
|
||||||
new (std::addressof (new_array[i])) Type ();
|
new (std::addressof (new_array[i])) Type ();
|
||||||
new_array[i] = std::move (arrayZ[i]);
|
new_array[i] = std::move (arrayZ[i]);
|
||||||
|
arrayZ[i].~Type ();
|
||||||
}
|
}
|
||||||
unsigned old_length = length;
|
|
||||||
shrink_vector (0);
|
|
||||||
length = old_length;
|
|
||||||
hb_free (arrayZ);
|
hb_free (arrayZ);
|
||||||
}
|
}
|
||||||
return new_array;
|
return new_array;
|
||||||
|
@ -302,15 +300,6 @@ struct hb_vector_t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T = Type,
|
|
||||||
hb_enable_if (hb_is_trivially_destructible(T))>
|
|
||||||
void
|
|
||||||
shrink_vector (unsigned size)
|
|
||||||
{
|
|
||||||
length = size;
|
|
||||||
}
|
|
||||||
template <typename T = Type,
|
|
||||||
hb_enable_if (!hb_is_trivially_destructible(T))>
|
|
||||||
void
|
void
|
||||||
shrink_vector (unsigned size)
|
shrink_vector (unsigned size)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue