rツリーから値を削除しようとするとコンパイルエラーが発生します。私はまた、問題を引き起こしていると思われるボックスと一緒に未処理のポインタを格納する - 私はint、文字列または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を上げています(ブースト1.61と同じエラー)。
からインスピレーションを得た、それは多くのクリーナーバックデータにアクセスすることができます。 –