fix for VirtualMemList
This commit is contained in:
parent
5048b88106
commit
119c3d1af7
@ -41,14 +41,19 @@ public:
|
|||||||
return base[i];
|
return base[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Vector compatibility: Use insert() if you want the inserted thing as reference too */
|
|
||||||
VML_INLINE void push_back(T elem) noexcept {
|
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);
|
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 {
|
VML_INLINE void pop_back() noexcept {
|
||||||
--end;
|
--end;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user