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

Fiddle with return type deduction for Point and Sphere centroid algorithm to prefer references #1178

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/geometry/algorithms/ArborX_Centroid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ using namespace GeometryTraits;
template <typename Point>
struct centroid<PointTag, Point>
{
KOKKOS_FUNCTION static constexpr auto apply(Point const &point)
KOKKOS_FUNCTION static constexpr auto &apply(Point const &point)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
KOKKOS_FUNCTION static constexpr auto &apply(Point const &point)
KOKKOS_FUNCTION static constexpr Point &apply(Point const &point)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ping

Copy link
Contributor Author

@aprokop aprokop Oct 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not see how it made any difference. Minor clarity, perhaps.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then say so, don't just ignore suggestions.
Otherwise I will quit approving ahead of time

{
return point;
}
Expand All @@ -62,7 +62,7 @@ struct centroid<BoxTag, Box>
template <typename Sphere>
struct centroid<SphereTag, Sphere>
{
KOKKOS_FUNCTION static constexpr auto apply(Sphere const &sphere)
KOKKOS_FUNCTION static constexpr decltype(auto) apply(Sphere const &sphere)
{
return sphere.centroid();
}
Expand Down
Loading