[vector] Add XXX markers for remaining places that need work

This commit is contained in:
Behdad Esfahbod 2022-01-14 12:55:48 -07:00
parent 92f179075f
commit 65a22836f8
1 changed files with 12 additions and 3 deletions

View File

@ -82,6 +82,7 @@ struct hb_vector_t
void fini () void fini ()
{ {
// XXX Destruct
hb_free (arrayZ); hb_free (arrayZ);
init (); init ();
} }
@ -272,8 +273,11 @@ struct hb_vector_t
return false; return false;
if (size > length) if (size > length)
// XXX reconstruct objects?! / destruct objects... // XXX construct objects.
memset (arrayZ + length, 0, (size - length) * sizeof (*arrayZ)); memset (arrayZ + length, 0, (size - length) * sizeof (*arrayZ));
else if (size < length)
// XXX destroy objects.
{}
length = size; length = size;
return true; return true;
@ -290,6 +294,7 @@ struct hb_vector_t
{ {
if (unlikely (i >= length)) if (unlikely (i >= length))
return; return;
// XXX Swap / move / destruct.
memmove (static_cast<void *> (&arrayZ[i]), memmove (static_cast<void *> (&arrayZ[i]),
static_cast<void *> (&arrayZ[i + 1]), static_cast<void *> (&arrayZ[i + 1]),
(length - i - 1) * sizeof (Type)); (length - i - 1) * sizeof (Type));
@ -299,8 +304,12 @@ struct hb_vector_t
void shrink (int size_) void shrink (int size_)
{ {
unsigned int size = size_ < 0 ? 0u : (unsigned int) size_; unsigned int size = size_ < 0 ? 0u : (unsigned int) size_;
if (size < length) if (size >= length)
length = size; return;
// XXX Destruct.
length = size;
} }
template <typename T> template <typename T>