Open
Description
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 float
s. 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.
Metadata
Metadata
Assignees
Labels
No labels