-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
fixedSomething works now, yay!Something works now, yay!flat_meowC++23 container adaptorsC++23 container adaptorsperformanceMust go fasterMust go faster
Description
Related to #6020 but IMO should be considered separately. Mostly a mirroring of LLVM-175086.
In flat_map and flat_set, sometimes we call unique with a synthesized equivalence relation to deduplicate elements after sorting. And it's probably redundant to call the comparator twice when deduplicating the sorted range.
When operator== is reliable, we can just use it for unique (addressed in #6024).
When it's not reliable, I think it will be better to
- introduce a modified version of
uniquewhich doesn't require equivalence relation, and - pass something similar to
key_compareto that algorithm to deduplicate elements.
Moreover, it turns out that key-equiv in the standard wording is possibly pointless. It's unclear to me whether the current wording requires particular side effects from synthesized equivalence comparisons. If so, we should also file an LWG issue to get rid of such requirements.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
fixedSomething works now, yay!Something works now, yay!flat_meowC++23 container adaptorsC++23 container adaptorsperformanceMust go fasterMust go faster