mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-29 17:44:06 +01:00
[map] Speed up operator= for trivial item types
This commit is contained in:
1 parent
78e5920dcc
commit
fd282dcfe7
1 file changed
+10
-2
+10
-2
@@ -47,7 +47,7 @@ struct hb_hashmap_t
|
||||
hb_hashmap_t () { init (); }
|
||||
~hb_hashmap_t () { fini (); }
|
||||
|
||||
hb_hashmap_t (const hb_hashmap_t& o) : hb_hashmap_t ()
|
||||
void _copy (const hb_hashmap_t& o)
|
||||
{
|
||||
if (unlikely (!o.mask)) return;
|
||||
|
||||
@@ -70,8 +70,16 @@ struct hb_hashmap_t
|
||||
|
||||
alloc (o.population); hb_copy (o, *this);
|
||||
}
|
||||
|
||||
hb_hashmap_t (const hb_hashmap_t& o) : hb_hashmap_t () { _copy (o); }
|
||||
hb_hashmap_t& operator= (const hb_hashmap_t& o)
|
||||
{
|
||||
reset ();
|
||||
if (!items) { _copy (o); return *this; }
|
||||
alloc (o.population); hb_copy (o, *this); return *this;
|
||||
}
|
||||
|
||||
hb_hashmap_t (hb_hashmap_t&& o) noexcept : hb_hashmap_t () { hb_swap (*this, o); }
|
||||
hb_hashmap_t& operator= (const hb_hashmap_t& o) { reset (); alloc (o.population); hb_copy (o, *this); return *this; }
|
||||
hb_hashmap_t& operator= (hb_hashmap_t&& o) noexcept { hb_swap (*this, o); return *this; }
|
||||
|
||||
hb_hashmap_t (std::initializer_list<hb_pair_t<K, V>> lst) : hb_hashmap_t ()
|
||||
|
||||
Reference in new issue
Block a user