Skip to content

[libc++] Generalize __three_way_comparator for __make_projected #155878

@ldionne

Description

@ldionne

__map_value_compare is basically an instance of the on combinator:

auto on(func, transform) {
  return [](auto ...args) {
    return func(invoke(transform, args)...);
  };
};

I think we have something else that is extremely similar to that called _ProjectedPred (via __make_projected). I don't think we need to do that right now, but as a follow-up I'd like us to generalize this to use the same mechanism. The goal is for predicates created via __make_projected to also be picked up by this optimization, since we use __make_projected in many algorithms that use comparisons. That should be done in a separate patch though.

Originally posted by @ldionne in #155245 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    libc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.performance

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions