mirror of
https://github.com/apple/swift-collections
synced 2026-11-26 04:47:48 +00:00
[BasicContainers] RigidArray, UniqueArray: “precisely once” → “at most once”
Loosen guarantees about how many times closure arguments are getting called, so that e.g. insertions of zero items do not necessarily need to call their callback with an empty OutputSpan. (For these array types we can reinstate the guarantee later, if it turns out to be important/useful. However, the generalized primitives will need to allow their callbacks to get called an arbitrary number of times, and it seems useful to establish that (at least partially) with these simple array types too.)
This commit is contained in:
11 files changed
+18
-14
No files matched your search
@@ -45,7 +45,7 @@ extension UniqueArray where Element: ~Copyable {
|
||||
///
|
||||
/// - Parameters
|
||||
/// - count: The number of items to append to the array.
|
||||
/// - body: A callback that gets called precisely once to directly
|
||||
/// - body: A callback that gets called at most once to directly
|
||||
/// populate newly reserved storage within the array. The function
|
||||
/// is allowed to initialize fewer than `count` items. The array is
|
||||
/// appended however many items the callback adds to the output span
|
||||
|
||||
Reference in new issue
Block a user