tidwall / rtree

An R-tree implementation for Go
MIT License
315 stars 30 forks source link

BoxDist can't work with Nearby with a non-float64 point type because the return type is wrong #11

Closed dzfranklin closed 2 months ago

dzfranklin commented 2 months ago

These types don't work together:

func BoxDist[N numeric, T any](targetMin, targetMax [2]N,
    itemDist func(min, max [2]N, data T) N,
) (dist func(min, max [2]N, data T, item bool) N)

func Nearby(
    dist func(min, max [2]N, data T, item bool) float64,
    iter func(min, max [2]N, data T, dist float64) bool,
)

The return type of BoxDist is N, but Nearby requires a dist function that returns float64 regardless of N.

tidwall commented 2 months ago

I just pushed an update that should fix this issue.

dzfranklin commented 2 months ago

Thank you.