# Array Initializer with Access to Uninitialized Buffer

**URL:** <https://forums.swift.org/t/array-initializer-with-access-to-uninitialized-buffer/13689>\
**Category:** Pitches\
**Created:** [June 14, 2018, 9:32pm UTC](https://forums.swift.org/t/array-initializer-with-access-to-uninitialized-buffer/13689 "2018-06-14T21:32:52Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![benrimmington](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/benrimmington/32/695_2.png) [@benrimmington](https://forums.swift.org/u/benrimmington)\
**Post date:** [June 15, 2018, 9:15pm UTC](https://forums.swift.org/t/array-initializer-with-access-to-uninitialized-buffer/13689/12 "2018-06-15T21:15:33Z")

</div>

> [@nnnnnnnn](#):
>
> For `Array`, we would want to guarantee that the array has storage for exactly the specified number of elements.

But the [`Array.reserveCapacity(_:)`](https://github.com/apple/swift/blob/59fdc4da52b7457408a752840115c262c784e3af/stdlib/public/core/Array.swift#L985-L987) API doesn't guarantee an exact capacity either:

```swift
  /// For performance reasons, the size of the newly allocated storage might be
  /// greater than the requested capacity. Use the array's `capacity` property
  /// to determine the size of the new storage.

```

---

_[View the full topic](https://forums.swift.org/t/array-initializer-with-access-to-uninitialized-buffer/13689)._
