/* * Problem: boost::geometry::equals() does not compile when points are * compared; it does for (at least some) other geometries. * * Solution: #include * * This program verifies the problem and the fix; set the XXX_* macros * appropriately to turn on/off the point comparison and the inclusion * of the strategy. If points are not compared * (XXX_COMPARE_POINTS=0), this will compile; whereas, if points are * compared (XXX_COMPARE_POINTS=1), the strategy must be included * (XXX_INCLUDE_POINT_STRATEGY=1). * * Fix: presumably boost/geometry/algorithms/equals.hpp should include * boost/geometry/strategies/agnostic/point_in_point.hpp * * Note: I believe this same problem recurs for other algorithms, * e.g., intersection() and perhaps others. */ #define XXX_COMPARE_POINTS 1 #define XXX_INCLUDE_POINT_STRATEGY 0 #include #include #include #include #include #if XXX_INCLUDE_POINT_STRATEGY // XXX - required by boost::geometry::equals() for comparing points (not other geometries) #include #endif // XXX_INCLUDE_POINT_STRATEGY int main () { using point_type = boost::geometry::model::d2::point_xy; using box_type = boost::geometry::model::box; using polygon_type = boost::geometry::model::polygon; using multi_polygon_type = boost::geometry::model::multi_polygon; using boost::geometry::equals; #if XXX_COMPARE_POINTS point_type point; equals(point,point); #endif // XXX_COMPARE_POINTS box_type box; equals(box,box); polygon_type polygon; equals(polygon,polygon); multi_polygon_type multi_polygon; equals(multi_polygon,multi_polygon); }