From 471e96e55d3366a6ad723fe88c9aa895921c048f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 9 Jan 2019 12:42:01 -0800 Subject: [PATCH] [iter] Use forwarding references --- src/hb-iter.hh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/hb-iter.hh b/src/hb-iter.hh index ee8e9b95d..7b147fbbe 100644 --- a/src/hb-iter.hh +++ b/src/hb-iter.hh @@ -210,7 +210,7 @@ template , decltype (hb_declval (Proj) (hb_declval (typename Iter::item_t)))> { - hb_map_iter_t (const Iter& it, Proj f) : it (it), f (f) {} + hb_map_iter_t (const Iter& it, Proj&& f) : it (it), f (f) {} typedef decltype (hb_declval (Proj) (hb_declval (typename Iter::item_t))) __item_t__; enum { is_random_access_iterator = Iter::is_random_access_iterator }; @@ -230,7 +230,7 @@ struct hb_map_iter_t : template struct hb_map_iter_factory_t { - hb_map_iter_factory_t (Proj f) : f (f) {} + hb_map_iter_factory_t (Proj&& f) : f (f) {} template @@ -242,7 +242,7 @@ struct hb_map_iter_factory_t }; template inline hb_map_iter_factory_t -hb_map (Proj f) +hb_map (Proj&& f) { return hb_map_iter_factory_t (f); } template , typename Iter::item_t>, hb_iter_mixin_t, typename Iter::item_t> { - hb_filter_iter_t (const Iter& it_, Pred p, Proj f) : it (it_), p (p), f (f) + hb_filter_iter_t (const Iter& it_, Pred&& p, Proj&& f) : it (it_), p (p), f (f) { while (it && !p (f (*it))) ++it; } typedef typename Iter::item_t __item_t__; @@ -269,7 +269,7 @@ struct hb_filter_iter_t : template struct hb_filter_iter_factory_t { - hb_filter_iter_factory_t (Pred p, Proj f) : p (p), f (f) {} + hb_filter_iter_factory_t (Pred&& p, Proj&& f) : p (p), f (f) {} template @@ -282,7 +282,7 @@ struct hb_filter_iter_factory_t }; template inline hb_filter_iter_factory_t -hb_filter (Pred p, Proj f) +hb_filter (Pred&& p, Proj&& f) { return hb_filter_iter_factory_t (p, f); } /* hb_zip() */