minor libutils improvements
This commit is contained in:
committed by
Mathias Agopian
parent
499939ed3c
commit
c93aa4c90d
@@ -299,6 +299,16 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
UTILS_NOINLINE
|
||||
void shrink_to_fit() {
|
||||
if (size() < capacity()) {
|
||||
FixedCapacityVector t(construct_with_capacity, size(), allocator());
|
||||
t.mSize = size();
|
||||
std::uninitialized_move(begin(), end(), t.begin());
|
||||
this->swap(t);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
enum construct_with_capacity_tag{ construct_with_capacity };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user