r 트리에서 값을 제거하려고 할 때 컴파일 오류가 발생합니다. 나는 또한 문제를 일으키는 것으로 보이는 상자와 함께 미가공 포인터를 저장한다. int 나 string 또는 shared_ptr을 저장하면 오류가 발생하지 않는다.부스트 R 트리에 원시 포인터 저장 문제
shared_ptr로 전환 할 수있는 옵션은 기존 라이브러리에서 가져온 것이므로 모두 사용할 수 없습니다. 다른 해결 방법이 있습니까?
나는 다음과 같이 나무가 정의되어 있습니다
namespace bg = boost::geometry;
namespace bgi = boost::geometry::index;
namespace bgm = boost::geometry::model;
typedef boost::geometry::model::point<float, 2, bg::cs::cartesian> point_t;
typedef boost::geometry::model::box<point_t> box_t;
typedef std::pair<box_t, Data*> value_t;
boost::geometry::index::rtree<value_t, boost::geometry::index::quadratic<16>> rtree;
다음과 같이 실패 코드는 다음과 같습니다
while(!rtree.empty()) {
auto it = rtree.begin();
auto value = *it;
rtree.remove(value); // <-- this is where the error appears.
}
을 그리고 오류가 다음과 같다 :
...../boost/geometry/index/equal_to.hpp:127:60: error: ambiguous class template instantiation for 'struct boost::geometry::index::detail::equals<NdsInstance*, void>'
&& detail::equals<T2>::apply(l.second, r.second);
^
...../boost/geometry/index/equal_to.hpp:28:8: error: candidates are: struct boost::geometry::index::detail::equals<Geometry*, Tag>
struct equals<Geometry *, Tag>
^
...../boost/geometry/index/equal_to.hpp:37:8: error: struct boost::geometry::index::detail::equals<T, void>
struct equals<T, void>
^
...../boost/geometry/index/equal_to.hpp:127:60: error: incomplete type 'boost::geometry::index::detail::equals<NdsInstance*, void>' used in nested name specifier
&& detail::equals<T2>::apply(l.second, r.second);
^
전체를 코드 샘플은 Colliru에 있습니다. 나는 gcc 4.9.3을 사용하고 1.62를 올린다 (boost 1.61와 같은 에러).
에서 영감을, 그것이 많은 청소기 다시 데이터에 액세스 할 수 있습니다. –