mirror of
https://github.com/pocketpy/pocketpy
synced 2025-11-08 20:50:16 +00:00
Fix resize.
This commit is contained in:
parent
06a3acb83d
commit
98fdf5ad49
@ -203,6 +203,7 @@ struct vector {
|
|||||||
|
|
||||||
void resize(int size) {
|
void resize(int size) {
|
||||||
reserve(size);
|
reserve(size);
|
||||||
|
std::uninitialized_default_construct_n(_data + _size, size - _size);
|
||||||
_size = size;
|
_size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,7 +231,7 @@ struct vector {
|
|||||||
uninitialized_copy_n(begin, n, _data + _size);
|
uninitialized_copy_n(begin, n, _data + _size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void insert(T* it, const T& t) {
|
void insert(const T* it, const T& t) {
|
||||||
assert(it >= begin() && it <= end());
|
assert(it >= begin() && it <= end());
|
||||||
int pos = it - begin();
|
int pos = it - begin();
|
||||||
if(_size == _capacity) {
|
if(_size == _capacity) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user