This commit is contained in:
Matthias Koefferlein 2018-11-22 21:03:36 +01:00
parent edae71b0a8
commit 9539e36bc9
1 changed files with 12 additions and 8 deletions

View File

@ -975,20 +975,24 @@ private:
value_type *new_start = (value_type *) (new char [sizeof (value_type) * n]);
size_type l = last ();
size_type i = first ();
memcpy ((void *)(new_start + i), (void *)(mp_start + i), (l - i) * sizeof (Value));
size_type e = 0;
size_type e = size_type (mp_finish - mp_start);
if (mp_start) {
e = size_type (mp_finish - mp_start);
size_type l = last ();
size_type i = first ();
memcpy ((void *)(new_start + i), (void *)(mp_start + i), (l - i) * sizeof (Value));
delete [] ((char *) mp_start);
}
if (mp_rdata) {
mp_rdata->reserve (n);
}
if (mp_start) {
delete [] ((char *) mp_start);
}
mp_start = new_start;
mp_finish = mp_start + e;
mp_capacity = mp_start + n;