pool append move and copy

This commit is contained in:
2026-08-31 08:59:41 +02:00
parent cfb6a9b3dd
commit 4d2470b0c6
4 changed files with 37 additions and 3 deletions
+25
View File
@@ -107,6 +107,31 @@ class Pool {
pPos = 0;
}
/**
* Copy the data of another pool
*/
void AppendCopy(const Pool& v) {
if (!v.size()) return;
ExpandIf(v.size());
for (size_t i = 0; i < v.size(); i++) {
pData[pPos + i] = v.pData[i];
}
pPos += v.size();
}
/**
* Move the data of another pool
*/
void AppendMove(Pool& v) {
if (!v.size()) return;
ExpandIf(v.size());
for (size_t i = 0; i < v.size(); i++) {
pData[pPos + i] = std::move(v.pData[i]);
}
pPos += v.size();
v.ResetFast();
}
size_t size() const { return pPos; }
size_t capacity() const { return pCap; }
T& at(size_t idx) { return pData[idx]; }