[Boost-bugs] [Boost C++ Libraries] #12566: rtree: equal_to ambiguous template instantiation when contain a raw pointer in pair, calling method remove

Subject: [Boost-bugs] [Boost C++ Libraries] #12566: rtree: equal_to ambiguous template instantiation when contain a raw pointer in pair, calling method remove
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-10-28 09:26:23


#12566: rtree: equal_to ambiguous template instantiation when contain a raw pointer
in pair, calling method remove
------------------------------+---------------------------
 Reporter: cedric@… | Owner: barendgehrels
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: geometry
  Version: Boost 1.61.0 | Severity: Regression
 Keywords: |
------------------------------+---------------------------
 Im trying to compile this example:

 main.cpp:
 {{{
 #include <boost/geometry.hpp>

 namespace bg = boost::geometry;
 namespace bgi = boost::geometry::index;
 namespace bgm = boost::geometry::model;

 int main() {
     using Point = bgm::point<double, 2,
 bg::cs::spherical_equatorial<bg::degree>>;
     using ValueType = std::pair<Point, int*>;
     using Rtree = bgi::rtree<ValueType, bgi::quadratic<16>>;

     int a,b;
     Rtree rtree;
     rtree.insert(std::make_pair(Point(45,45), &a));
     rtree.insert(std::make_pair(Point(45,45), &b));
     rtree.remove(std::make_pair(Point(45,45), &b));

     return 0;
 }
 }}}
 using gcc 6.2.1 and boost 1.61.0 or 1.58.0 (no problem with boost 1.52.0)

 I got folowing error:

 {{{
 /usr/include/boost/geometry/index/equal_to.hpp:127:41: erreur : ambiguous
 template instantiation for ‘struct
 boost::geometry::index::detail::equals<int*, void>’
              && detail::equals<T2>::apply(l.second, r.second);
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
 /usr/include/boost/geometry/index/equal_to.hpp:28:8: note : candidats sont
 : template<class Geometry, class Tag> struct
 boost::geometry::index::detail::equals<Geometry*, Tag> [with Geometry =
 int; Tag = void]
  struct equals<Geometry *, Tag>
         ^~~~~~~~~~~~~~~~~~~~~~~
 /usr/include/boost/geometry/index/equal_to.hpp:37:8: note :
 template<class T> struct boost::geometry::index::detail::equals<T, void>
 [with T = int*]
  struct equals<T, void>
         ^~~~~~~~~~~~~~~
 /usr/include/boost/geometry/index/equal_to.hpp:127:41: erreur : incomplete
 type ‘boost::geometry::index::detail::equals<int*, void>’ used in nested
 name specifier
              && detail::equals<T2>::apply(l.second, r.second);
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
 }}}

 no problem if I replace int* by int

 also document here [http://stackoverflow.com/questions/39970131/issue-
 storing-raw-pointers-in-boost-r-tree]

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12566>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:20 UTC