[Accepted with modifications] SE-0527: UniqueArray

Hi all --

UniqueArray was previously accepted in principle, with a focused re-review to discuss the naming of the reallocate operation that ended on June 2.

The LSG has agreed to use the name setCapacity(_ newValue: Int) for this operation, with the semantics of doing nothing if newValue == capacity and otherwise reallocating the storage to hold max(count, newValue) elements. In particular, if newValue < capacity, the allocation will shrink.

reserveCapacity(_:) will continue to be provided, with the same semantics as generally seen on other types: it ensures that the UniqueArray has at least the requested capacity, but a geometric growth factor may be applied internally, or the allocation otherwise padded to a larger value.

Thank you for your participation in Swift evolution.
– Steve Canon

14 Likes