2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Opened histories stack finished, stack of states in vector_of_moveable.

This commit is contained in:
John Preston
2016-07-05 17:48:36 +03:00
parent cd696ade4e
commit 8ea47c1811
12 changed files with 184 additions and 103 deletions

View File

@@ -141,7 +141,10 @@ private:
void reallocate(int newCapacity) {
auto newPlainData = operator new[](newCapacity * sizeof(T));
for (int i = 0; i < _size; ++i) {
*(reinterpret_cast<T*>(newPlainData) + i) = std_::move(*(data() + i));
auto oldLocation = data() + i;
auto newLocation = reinterpret_cast<T*>(newPlainData) + i;
new (newLocation) T(std_::move(*oldLocation));
oldLocation->~T();
}
std::swap(_plaindata, newPlainData);
_capacity = newCapacity;