From 27b2093009745b6c30663605f45ac95deb1562cc Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 8 May 2019 15:32:57 -0700 Subject: [PATCH] [map] Return rvalues from keys()/values() --- src/hb-algs.hh | 7 +++++++ src/hb-map.hh | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/hb-algs.hh b/src/hb-algs.hh index d377772..0db2184 100644 --- a/src/hb-algs.hh +++ b/src/hb-algs.hh @@ -43,6 +43,13 @@ HB_FUNCOBJ (hb_identity); struct { + template hb_remove_reference + operator () (T&& v) const { return v; } +} +HB_FUNCOBJ (hb_rvalue); + +struct +{ template bool operator () (T&& v) const { return bool (hb_forward (v)); } } diff --git a/src/hb-map.hh b/src/hb-map.hh index 6eac8c3..2f06595 100644 --- a/src/hb-map.hh +++ b/src/hb-map.hh @@ -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: -- 2.7.4