mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-24 00:11:14 +01:00
[vector] Pre-allocate if iterator has random-access length
This commit is contained in:
1 parent
11135150a7
commit
f15858be5f
1 file changed
+2
@@ -51,6 +51,8 @@ struct hb_vector_t
|
||||
hb_requires (hb_is_iterable (Iterable))>
|
||||
hb_vector_t (const Iterable &o) : hb_vector_t ()
|
||||
{
|
||||
if (hb_iter (o).is_random_access_iterator)
|
||||
alloc (hb_len (hb_iter (o)));
|
||||
hb_copy (o, *this);
|
||||
}
|
||||
hb_vector_t (const hb_vector_t &o) : hb_vector_t ()
|
||||
|
||||
Reference in new issue
Block a user