Skip to content

compare_pointees.hpp should permit a predicate #72

Description

@BenFrantzDale

Suppose I have

std::optional<std::pair<int, float>> a, b;

and I want to test equality (or less-than-ness) of the float part, still treating them as optional. That is, thinking of them as optional floats. If equal_pointees had a predicate argument, I could do

equal_pointees(a, b, [](auto& x, auto& y) { return std::get<float>(x) == std::get<float>(y); });

The particular case I'd use this is where I've got a big struct representing the state of a view. For the current frame, I have a pointer to the previous one and a pointer to the current one and I want to decide if I have to a certain part of the work of redrawing. That is, either they have different nullness that's different, or if they are both non-null then compare a projection of them that pertains to the thing I care about.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions