Skip to content
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

Make closest_points_first work for all point types #41962

Merged

Conversation

jbytheway
Copy link
Contributor

Summary

SUMMARY: None

Purpose of change

Previously we had separate functions closest_points_first and closest_tripoints_first. We'd like to extend this functionality to coord_point, but it's easier to do if both the raw underlying functions have the same name (so the generic wrapper can be the same).

Describe the solution

Rename closest_tripoints_first to closest_points_first (they are chosen between based on overload resolution), and add a wrapper to allow coord_point to be used similarly.

Describe alternatives you've considered

Could have made one templatized function, rather than the current situation where we have various wrapper functions and a single implementation of the algorithm. But I didn't want to move the implementation into a header when it wasn't already there, and the wrapper should be pretty fast since it's basically just doing a malloc+memcpy+free (and the wrapped function is already doing multiple allocations).

Testing

Added a new unit test.

Additional context

A chunk of #41693.

Previously we had separate functions closest_points_first and
closest_tripoints_first.  We'd like to extend this functionality to
coord_point, but it's easier to do if both the raw underlying functions
have the same name (so the generic wrapper can be the same).

To that end, rename closest_tripoints_first to closest_points_first
(they are chosen between based on overload resolution), and add a
wrapper to allow coord_point to be used similarly.
@ZhilkinSerg ZhilkinSerg added [C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style labels Jul 9, 2020
@ZhilkinSerg ZhilkinSerg merged commit 7cdd620 into CleverRaven:master Jul 9, 2020
@jbytheway jbytheway deleted the genericise_closest_points_first branch July 9, 2020 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants