Skip to content

Instantly share code, notes, and snippets.

@curzel-it
Created June 12, 2017 22:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save curzel-it/89d37ecd5d7c658eb1ffed31d726bf0a to your computer and use it in GitHub Desktop.
Save curzel-it/89d37ecd5d7c658eb1ffed31d726bf0a to your computer and use it in GitHub Desktop.
Simple extension to init an array and reserve an initial capacity
extension Array where Element: Equatable {
/**
* Will init the array and reserve an initial capacity.
*/
init(withReservedCapacity rc: Int) {
self.init()
self.reserveCapacity(rc)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment