-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a variant of closest_points_first that takes a predicate #75961
base: master
Are you sure you want to change the base?
Conversation
I'm not sure why this is failing. Building succeeds on my machine, and I've included point.h in all of the referenced files. |
6747a37
to
a40e8ac
Compare
878aded
to
0dde0b1
Compare
Build failures appear to be unrelated, though I would prefer to rerun to check. |
sadly can't be fixed by rerun, #76349 need to be merged first |
31a322b
to
87aab5e
Compare
Can you resolve conflicts? |
44f5890
to
6abaf58
Compare
Merge conflicts resolved. |
6abaf58
to
e622774
Compare
Is clang angry from this PR or some other reason? |
Yes, it's this PR. I should probably mark as draft until I get around to fixing the issues. |
Could you please resolve conflicts? |
Part of CleverRaven#75945. The variant will be used in pathfinding to find the nearest ramp or stairs without having to enumerate all points. * Make find_point_closest_first generic over point and tripoint. * Extract common code between closest_points_first variants Co-authored-by: prharvey <[email protected]>
e87af08
to
d488bbe
Compare
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Summary
None
Purpose of change
Part of #75945. The variant will be used in pathfinding to find the nearest ramp or stairs without having to enumerate all points.
Describe the solution
Adds a variant of
closest_points_first
,find_closest_points_first
that takes a predicate function. It is generic over point and tripoint, thereby avoiding a double allocation intripoint
variants.Describe alternatives you've considered
The bounds check could be skipped by adding an inbounds variant, but this is certainly too much work to skip three checks.
Using
std::variant
instead oftypename Point
. I'm not particularly biased towards one way or another.Testing
As long as current
closest_points_first
tests pass, this will have been implemented correctly.Additional context