From 83cecd80d93a1e09231b8deaa6ecf8cd44875dfd Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 9 Jan 2019 19:49:13 -0800 Subject: [PATCH] [iter] Default projection to identity --- src/hb-algs.hh | 6 +++--- src/hb-iter.hh | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/hb-algs.hh b/src/hb-algs.hh index a61925aed..86d7fec93 100644 --- a/src/hb-algs.hh +++ b/src/hb-algs.hh @@ -31,7 +31,7 @@ #include "hb-null.hh" -static HB_UNUSED struct +static HB_UNUSED struct hb_identity_t { template T operator () (const T& v) const { return v; } @@ -55,13 +55,13 @@ struct hb_pair_t template static inline hb_pair_t hb_pair (T1 a, T2 b) { return hb_pair_t (a, b); } -static HB_UNUSED struct +static HB_UNUSED struct hb_first_t { template typename Pair::first_t operator () (const Pair& pair) const { return pair.first; } } hb_first; -static HB_UNUSED struct +static HB_UNUSED struct hb_second_t { template typename Pair::second_t operator () (const Pair& pair) const { return pair.second; } diff --git a/src/hb-iter.hh b/src/hb-iter.hh index 7b147fbbe..0f0b4de01 100644 --- a/src/hb-iter.hh +++ b/src/hb-iter.hh @@ -280,9 +280,9 @@ struct hb_filter_iter_factory_t Pred p; Proj f; }; -template +template inline hb_filter_iter_factory_t -hb_filter (Pred&& p, Proj&& f) +hb_filter (Pred&& p, Proj&& f = hb_identity) { return hb_filter_iter_factory_t (p, f); } /* hb_zip() */