Skip to content

Geometry nearest functions should take generic collection #7873

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

Open
rzblue opened this issue Mar 20, 2025 · 1 comment
Open

Geometry nearest functions should take generic collection #7873

rzblue opened this issue Mar 20, 2025 · 1 comment
Labels
type: feature Brand new functionality, features, pages, workflows, endpoints, etc.

Comments

@rzblue
Copy link
Member

rzblue commented Mar 20, 2025

In java, nearest currently takes a List<T> but could take Collection<T> with no implementation changes. In C++ we currently take std::span but could take iterators.

@rzblue rzblue added the type: feature Brand new functionality, features, pages, workflows, endpoints, etc. label Mar 20, 2025
@calcmogul
Copy link
Member

calcmogul commented Mar 20, 2025

Taking an iterator pair directly is frowned upon in modern C++ algorithms, and it would be an API-breaking change. std::span<const Pose2d> or the following are preferred instead.

  template <typename R>
    requires std::ranges::forward_range<R> &&
             std::same_as<std::ranges::range_value_t<R>, Pose2d>
  constexpr Pose2d Nearest(const R&& poses) const {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature Brand new functionality, features, pages, workflows, endpoints, etc.
Projects
None yet
Development

No branches or pull requests

2 participants