From 7557e34872c846433c2465b21b99bf7c5f961673 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 21 Dec 2018 17:21:19 -0500 Subject: [PATCH] [iter] Move hb_fill() and hb_copy() to hb-iter.hh --- src/hb-iter.hh | 18 ++++++++++++++++++ src/test-iter.cc | 16 ---------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/hb-iter.hh b/src/hb-iter.hh index c3f3ab958..876793680 100644 --- a/src/hb-iter.hh +++ b/src/hb-iter.hh @@ -113,4 +113,22 @@ struct hb_iter_t }; +/* Functions operating on iterators or iteratables. */ + +template inline void +hb_fill (const C& c, const V &v) +{ + for (typename C::iter_t i (c); i; i++) + hb_assign (*i, v); +} + +template inline bool +hb_copy (hb_iter_t &id, hb_iter_t &is) +{ + for (; id && is; ++id, ++is) + *id = *is; + return !is; +} + + #endif /* HB_ITER_HH */ diff --git a/src/test-iter.cc b/src/test-iter.cc index 8a98df4e5..4daa971d5 100644 --- a/src/test-iter.cc +++ b/src/test-iter.cc @@ -59,22 +59,6 @@ struct some_array_t hb_array_t arr; }; - -template inline void -hb_fill (const C& c, const V &v) -{ - for (typename C::iter_t i (c); i; i++) - hb_assign (*i, v); -} - -template inline bool -hb_copy (hb_iter_t &id, hb_iter_t &is) -{ - for (; id && is; ++id, ++is) - *id = *is; - return !is; -} - int main (int argc, char **argv) {