geometry icon indicating copy to clipboard operation
geometry copied to clipboard

Boost.Polygon adaptation not working

Open MPcoreDev opened this issue 2 years ago • 3 comments
trafficstars

I am trying to use 'simplify' algo on a Boost.Polygon and it fails. Please find the link to the oneline example of the issue: https://godbolt.org/z/hYofEbr68

The error is: /opt/compiler-explorer/libs/boost_1_81_0/boost/geometry/algorithms/simplify.hpp:606:29: error: cannot bind non-const lvalue reference of type 'boost::geometry::adapt::bp::ring_proxy<boost::polygon::polygon_with_holes_data<int> >&' to an rvalue of type 'boost::geometry::ring_return_type<boost::polygon::polygon_with_holes_data<int> >::type' {aka 'boost::geometry::adapt::bp::ring_proxy<boost::polygon::polygon_with_holes_data<int> >'}

MPcoreDev avatar Mar 17 '23 15:03 MPcoreDev

I have the same issue with the mapbox::geometry to boost::geometry adapter. (The adapter code is here: https://github.com/mapbox/spatial-algorithms/blob/master/include/mapbox/geometry/algorithms/detail/boost_adapters.hpp)

JD31 avatar Mar 17 '23 15:03 JD31

Thanks for the report. After some quick workarounds I am getting error: no matching function for call to ‘swap(const boost::polygon::point_data<double>&, const boost::polygon::point_data<double>&)’ triggered from https://github.com/boostorg/geometry/blob/develop/include/boost/geometry/algorithms/simplify.hpp#L537 Maybe the begin and end operators of boost::polygon return a constant reference. It needs some further investigation.

vissarion avatar Mar 22 '23 10:03 vissarion