[map] Add a couple more sink interfaces

pull/3885/head
Behdad Esfahbod 2 years ago
parent 90226eab89
commit a3a218edb5
  1. 4
      src/hb-map.hh
  2. 2
      src/test-map.cc

@ -320,6 +320,10 @@ struct hb_hashmap_t
{ set (v.first, v.second); return *this; }
hb_hashmap_t& operator << (const hb_pair_t<K, V&&>& v)
{ set (v.first, std::move (v.second)); return *this; }
hb_hashmap_t& operator << (const hb_pair_t<K&&, V>& v)
{ set (std::move (v.first), v.second); return *this; }
hb_hashmap_t& operator << (const hb_pair_t<K&&, V&&>& v)
{ set (std::move (v.first), std::move (v.second)); return *this; }
protected:

@ -199,6 +199,8 @@ main (int argc, char **argv)
assert (v.length == 1);
m1 << hb_pair_t<vector_t, vector_t&&> {vector_t {4}, std::move (v)};
assert (v.length == 0);
m1 << hb_pair_t<vector_t&&, vector_t> {vector_t {4}, vector_t {5}};
m1 << hb_pair_t<vector_t&&, vector_t&&> {vector_t {4}, vector_t {5}};
hb_hashmap_t<vector_t, vector_t> m2;
vector_t v2 {3};

Loading…
Cancel
Save