[iter] Move hb_fill() and hb_copy() to hb-iter.hh

This commit is contained in:
Behdad Esfahbod 2018-12-21 17:21:19 -05:00
parent 5e1840e031
commit 7557e34872
2 changed files with 18 additions and 16 deletions

View File

@ -113,4 +113,22 @@ struct hb_iter_t
};
/* Functions operating on iterators or iteratables. */
template <typename C, typename V> inline void
hb_fill (const C& c, const V &v)
{
for (typename C::iter_t i (c); i; i++)
hb_assign (*i, v);
}
template <typename S, typename D> inline bool
hb_copy (hb_iter_t<D> &id, hb_iter_t<S> &is)
{
for (; id && is; ++id, ++is)
*id = *is;
return !is;
}
#endif /* HB_ITER_HH */

View File

@ -59,22 +59,6 @@ struct some_array_t
hb_array_t<T> arr;
};
template <typename C, typename V> inline void
hb_fill (const C& c, const V &v)
{
for (typename C::iter_t i (c); i; i++)
hb_assign (*i, v);
}
template <typename S, typename D> inline bool
hb_copy (hb_iter_t<D> &id, hb_iter_t<S> &is)
{
for (; id && is; ++id, ++is)
*id = *is;
return !is;
}
int
main (int argc, char **argv)
{