[map] Return rvalues from keys()/values()
authorBehdad Esfahbod <behdad@behdad.org>
Wed, 8 May 2019 22:32:57 +0000 (15:32 -0700)
committerBehdad Esfahbod <behdad@behdad.org>
Wed, 8 May 2019 22:32:57 +0000 (15:32 -0700)
src/hb-algs.hh
src/hb-map.hh

index d377772..0db2184 100644 (file)
@@ -43,6 +43,13 @@ HB_FUNCOBJ (hb_identity);
 
 struct
 {
+  template <typename T> hb_remove_reference<T>
+  operator () (T&& v) const { return v; }
+}
+HB_FUNCOBJ (hb_rvalue);
+
+struct
+{
   template <typename T> bool
   operator () (T&& v) const { return bool (hb_forward<T> (v)); }
 }
index 6eac8c3..2f06595 100644 (file)
@@ -221,12 +221,14 @@ struct hb_hashmap_t
     + hb_array (items, mask ? mask + 1 : 0)
     | hb_filter (&item_t::is_real)
     | hb_map (&item_t::key)
+    | hb_map (hb_rvalue)
   )
   auto values () const HB_AUTO_RETURN
   (
     + hb_array (items, mask ? mask + 1 : 0)
     | hb_filter (&item_t::is_real)
     | hb_map (&item_t::value)
+    | hb_map (hb_rvalue)
   )
 
   protected: