提交 357c7c61 编写于 作者: B Behdad Esfahbod

[vector] Add copy constructor and assignment operator

上级 6f69c9d2
......@@ -38,8 +38,13 @@ struct hb_vector_t
typedef Type item_t;
static constexpr unsigned item_size = hb_static_size (Type);
HB_NO_COPY_ASSIGN_TEMPLATE (hb_vector_t, Type);
hb_vector_t () { init (); }
hb_vector_t (const hb_vector_t &o)
{
init ();
alloc (o.length);
hb_iter (o) | hb_sink (this);
}
~hb_vector_t () { fini (); }
unsigned int length;
......@@ -69,6 +74,16 @@ struct hb_vector_t
fini ();
}
void reset () { resize (0); }
hb_vector_t& operator = (const hb_vector_t &o)
{
reset ();
alloc (o.length);
hb_iter (o) | hb_sink (this);
return *this;
}
const Type * arrayZ () const { return arrayZ_; }
Type * arrayZ () { return arrayZ_; }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册