fix for VirtualMemList

This commit is contained in:
Richard Thier 2024-09-03 20:16:32 +02:00
parent 5048b88106
commit 119c3d1af7

View File

@ -41,14 +41,19 @@ public:
return base[i];
}
/** Vector compatibility: Use insert() if you want the inserted thing as reference too */
VML_INLINE void push_back(T elem) noexcept {
// Smaller solution: base[end++] = elem;
// Smallest solution:
// base[end++] = elem;
// Non-working, but logically better solution:
// T *value = (T*) alloc(&a, sizeof(T), sizeof(T), 1);
// *value = elem;
// Longer solution (more correct - but I let it waste a bit of memory)
T *value = (T*) alloc(&a, sizeof(T), sizeof(T), 1);
*value = elem;
base[end++] = elem;
}
/** Vector compatibility: Use pop() if you want the popped thing out as copy too */
VML_INLINE void pop_back() noexcept {
--end;
}