-
Notifications
You must be signed in to change notification settings - Fork 10.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide a way to coalesce the entries in a RangeMap #2665
Comments
Could you live with a |
Definitely; I'd expect it to be a copy operation as a live view would eliminate the benefit of reducing the underlying number of ranges in use (and probably be much more complex to implement). |
…ntries. #2665 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=143507326
We opted to add a mutating |
@dimo414 I'd like to report "merging + coalescing" as a general use case, that |
RangeMap
doesn't coalesce connected ranges (by design), and it would be nice if there were a built-in way to coalesce connected ranges if they have the same value. For example:Is roughly equivalent to:
And it can be both a time and space savings to be working with a smaller data structure. Particularly for a case such as a
RangeMap
built up fromRange.singleton()
keys acoalesced()
operation could save a lot of resources.The text was updated successfully, but these errors were encountered: