Created
June 12, 2017 22:25
-
-
Save curzel-it/89d37ecd5d7c658eb1ffed31d726bf0a to your computer and use it in GitHub Desktop.
Simple extension to init an array and reserve an initial capacity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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