diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-11-08 13:30:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-08 13:30:26 +0100 |
commit | 02f9ccf3488eada0a624841376ccf5e6e10cd612 (patch) | |
tree | d79358f4ee29b88a99b2245b224906cbb58ee8d0 /thirdparty/harfbuzz/src/hb-set.hh | |
parent | 6c8a1683a559042e8499b8037168749d8086aa63 (diff) | |
parent | da8aedfc171843388a1743b107dea5a98a6ab6eb (diff) |
Merge pull request #54586 from bruvzg/hb310
Diffstat (limited to 'thirdparty/harfbuzz/src/hb-set.hh')
-rw-r--r-- | thirdparty/harfbuzz/src/hb-set.hh | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/thirdparty/harfbuzz/src/hb-set.hh b/thirdparty/harfbuzz/src/hb-set.hh index 437e234361..8841427189 100644 --- a/thirdparty/harfbuzz/src/hb-set.hh +++ b/thirdparty/harfbuzz/src/hb-set.hh @@ -42,9 +42,22 @@ struct hb_sparseset_t ~hb_sparseset_t () { fini (); } hb_sparseset_t (const hb_sparseset_t& other) : hb_sparseset_t () { set (other); } - void operator= (const hb_sparseset_t& other) { set (other); } - // TODO Add move construtor/assign - // TODO Add constructor for Iterator + hb_sparseset_t (hb_sparseset_t&& other) : hb_sparseset_t () { s = std::move (other.s); } + hb_sparseset_t& operator= (const hb_sparseset_t& other) { set (other); return *this; } + hb_sparseset_t& operator= (hb_sparseset_t&& other) { hb_swap (*this, other); return *this; } + friend void swap (hb_sparseset_t& a, hb_sparseset_t& b) { hb_swap (a.s, b.s); } + + hb_sparseset_t (std::initializer_list<hb_codepoint_t> lst) : hb_sparseset_t () + { + for (auto&& item : lst) + add (item); + } + template <typename Iterable, + hb_requires (hb_is_iterable (Iterable))> + hb_sparseset_t (const Iterable &o) : hb_sparseset_t () + { + hb_copy (o, *this); + } void init_shallow () { s.init (); } void init () @@ -140,7 +153,18 @@ struct hb_sparseset_t operator iter_t () const { return iter (); } }; -struct hb_set_t : hb_sparseset_t<hb_bit_set_invertible_t> {}; +struct hb_set_t : hb_sparseset_t<hb_bit_set_invertible_t> +{ + hb_set_t () = default; + ~hb_set_t () = default; + hb_set_t (hb_set_t& o) = default; + hb_set_t& operator= (const hb_set_t& other) = default; + hb_set_t& operator= (hb_set_t&& other) = default; + hb_set_t (std::initializer_list<hb_codepoint_t> lst) : hb_sparseset_t<hb_bit_set_invertible_t> (lst) {} + template <typename Iterable, + hb_requires (hb_is_iterable (Iterable))> + hb_set_t (const Iterable &o) : hb_sparseset_t<hb_bit_set_invertible_t> (o) {} +}; static_assert (hb_set_t::INVALID == HB_SET_VALUE_INVALID, ""); |