| 247 | /// <param name="capacity">The new capacity.</param> |
| 248 | /// <param name="preserveContents">True if preserve collection data when changing its size, otherwise collection after resize will be empty.</param> |
| 249 | void SetCapacity(const int32 capacity, const bool preserveContents = true) |
| 250 | { |
| 251 | if (capacity == _capacity) |
| 252 | return; |
| 253 | ASSERT(capacity >= 0); |
| 254 | const int32 count = preserveContents ? (_count < capacity ? _count : capacity) : 0; |
| 255 | _allocation.Relocate(ToItemCapacity(capacity), ToItemCount(_count), ToItemCount(count)); |
| 256 | _capacity = capacity; |
| 257 | _count = count; |
| 258 | } |
| 259 | |
| 260 | /// <summary> |
| 261 | /// Resizes the collection to the specified size. If the size is equal or less to the current capacity no additional memory reallocation in performed. |
no test coverage detected