提交 8a8d45b9 编写于 作者: B Behdad Esfahbod

[iter] Adjust hb_copy() and use it

Untested.
上级 ba4b7be4
......@@ -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);
}
......
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册