[iter] Adjust hb_copy() and use it

Untested.
This commit is contained in:
Behdad Esfahbod 2019-03-31 19:00:09 -07:00
parent ba4b7be455
commit 8a8d45b924
2 changed files with 6 additions and 9 deletions

View File

@ -585,14 +585,11 @@ hb_fill (C& c, const V &v)
*i = v;
}
template <typename S, typename D,
hb_enable_if (hb_is_iterator (S) && hb_is_iterator (D))>
inline bool
hb_copy (D id, S is)
template <typename S, typename D>
inline void
hb_copy (D&& id, S&& is)
{
for (; id && is; ++id, ++is)
*id = *is;
return !is;
hb_iter (id) | hb_sink (is);
}

View File

@ -43,7 +43,7 @@ struct hb_vector_t
{
init ();
alloc (o.length);
hb_iter (o) | hb_sink (this);
hb_copy (o, *this);
}
hb_vector_t (hb_vector_t &&o)
{
@ -87,7 +87,7 @@ struct hb_vector_t
{
reset ();
alloc (o.length);
hb_iter (o) | hb_sink (this);
hb_copy (o, *this);
return *this;
}
hb_vector_t& operator = (hb_vector_t &&o)