mirror of
https://github.com/apple/swift-collections
synced 2026-11-27 04:54:21 +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
@@ -43,7 +43,7 @@ extension UniqueArray where Element: ~Copyable {
|
||||
/// - subrange: The subrange of the array to replace. The bounds of
|
||||
/// the range must be valid indices in the array.
|
||||
/// - newCount: the number of items to replace the old subrange.
|
||||
/// - 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 called with an empty output span of capacity `newCount`,
|
||||
/// and it must fully populate it before returning.
|
||||
|
||||
Reference in new issue
Block a user