aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CommonLibs/Vector.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/CommonLibs/Vector.h b/CommonLibs/Vector.h
index 7062e17..eae674b 100644
--- a/CommonLibs/Vector.h
+++ b/CommonLibs/Vector.h
@@ -92,6 +92,13 @@ template <class T> class Vector {
mEnd = mStart + newSize;
}
+ /** Reduce addressable size of the Vector, keeping content. */
+ void shrink(size_t newSize)
+ {
+ assert(newSize <= mEnd - mStart);
+ mEnd = mStart + newSize;
+ }
+
/** Release memory and clear pointers. */
void clear() { resize(0); }