boostorg / boostorg/geometry

How to create Rtree of Pointers to coordinates

Open
#777 8 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
517
Forks
232
PR merge metrics
No merged PRs in 30d

Description

Sorry If I missed this in the documentation. I've been searching for a while, but I don't see it.
I have been using code similar to that shown below for a while. I can no longer compile after upgrading to boost::geometry1.73. I believe I was using ~1.6x. My question is how can I do this in 1.73?
Note. this seems similar to the documented example with shared_ptr, but that example compiles (even with rtree.remove added to the sample), while this one chokes on rtree.remove). I'm compiling with visual studio 16.8.2

```
#include
#include

namespace bg = boost::geometry;
namespace bgi = boost::geometry::index;
namespace bgm = boost::geometry::model;
namespace cs = boost::geometry::cs;
struct Point {
float x;
float y;
};

// this is actually a large structure. fields omitted to simplify
struct Unit {
Point pos;
};

using UnitPtr = Unit const *;

struct indexable {
using V = UnitPtr;

typedef Unit const &result_type;
const Unit & operator()(V const &v) const { return *v; }
};

BOOST_GEOMETRY_REGISTER_POINT_2D(Unit, float, cs::cartesian, pos.x, pos.y)

int main() {
using Rtree = bgi::rtree >;
Rtree rtree;

Unit a;
rtree.insert(&a);
rtree.remove(&a); // problem here with ambiguous template
// could be 'boost::geometry::index::detail::equals'
// or 'boost::geometry::index::detail::equals'

return 0;
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.