boostorg / boostorg/utility

compare_pointees.hpp should permit a predicate

Open
#72 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
51
Forks
71
PR merge metrics
No merged PRs in 30d

Description

Suppose I have
```
std::optional> 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(x) == std::get(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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.