[ContainersPreview] Add DrainableContainer above RangeReplaceableContainer - #707
Open
lorentey wants to merge 2 commits into
Open
[ContainersPreview] Add DrainableContainer above RangeReplaceableContainer#707lorentey wants to merge 2 commits into
DrainableContainer above RangeReplaceableContainer#707lorentey wants to merge 2 commits into
Conversation
…eReplaceableContainer into a new DrainableContainer protocol We have types that can usefully conform to `DrainableContainer` but not the full `RangeReplaceableContainer`; `OrderedSet` is one obvious example.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We have types that can usefully conform to
DrainableContainerbut not the fullRangeReplaceableContainer;OrderedSetis one obvious example.This reminded me that we don't have a
removeAll(where:)method yet; we'll need one as well as an in-place consuming variant. Ideally these would be implemented by default usingSubrangeConsumer, but that would require aDrainthat allows partial consumption -- which would be a large complicating factor. 🤔 The easy choice is to define a higher-order,InputSpan-basedconsumerequirement that preserves whatever elements the client leaves in the span, and then have the predicate-based methods forward to that. However, I'm hoping we can do better.Checklist