]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/geometry/test/algorithms/test_is_valid.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / test_is_valid.hpp
index df0be5b812bc0f627bab76abeba58a648047b3aa..8756ccf4d02a8fbc4d1fea058150447f84646f39 100644 (file)
@@ -1,8 +1,9 @@
 // Boost.Geometry (aka GGL, Generic Geometry Library)
 // Unit Test
 
-// Copyright (c) 2014-2017, Oracle and/or its affiliates.
+// Copyright (c) 2014-2021, Oracle and/or its affiliates.
 
+// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
 
 #include <string>
 
 #include <boost/core/ignore_unused.hpp>
-#include <boost/range.hpp>
+#include <boost/range/begin.hpp>
+#include <boost/range/end.hpp>
+#include <boost/range/size.hpp>
+#include <boost/range/value_type.hpp>
 #include <boost/variant/variant.hpp>
 
 #include <boost/geometry/core/closure.hpp>
@@ -46,8 +50,6 @@
 #include <boost/geometry/algorithms/num_points.hpp>
 #include <boost/geometry/algorithms/is_valid.hpp>
 
-#include <boost/geometry/algorithms/detail/check_iterator_range.hpp>
-
 #include <from_wkt.hpp>
 
 #ifdef BOOST_GEOMETRY_TEST_DEBUG
@@ -95,17 +97,17 @@ struct is_convertible_to_closed<Ring, bg::ring_tag, bg::open>
 template <typename Polygon>
 struct is_convertible_to_closed<Polygon, bg::polygon_tag, bg::open>
 {
-    typedef typename bg::ring_type<Polygon>::type ring_type;
+    using ring_type = typename bg::ring_type<Polygon>::type;
 
     template <typename InteriorRings>
     static inline
     bool apply_to_interior_rings(InteriorRings const& interior_rings)
     {
-        return bg::detail::check_iterator_range
-            <
-                is_convertible_to_closed<ring_type>
-            >::apply(boost::begin(interior_rings),
-                     boost::end(interior_rings));
+        return std::all_of(boost::begin(interior_rings),
+                           boost::end(interior_rings),
+                           []( auto const& ring ){
+                               return is_convertible_to_closed<ring_type>::apply(ring);
+                           });
     }
 
     static inline bool apply(Polygon const& polygon)
@@ -118,16 +120,15 @@ struct is_convertible_to_closed<Polygon, bg::polygon_tag, bg::open>
 template <typename MultiPolygon>
 struct is_convertible_to_closed<MultiPolygon, bg::multi_polygon_tag, bg::open>
 {
-    typedef typename boost::range_value<MultiPolygon>::type polygon;
+    using polygon_type = typename boost::range_value<MultiPolygon>::type;
 
     static inline bool apply(MultiPolygon const& multi_polygon)
     {
-        return bg::detail::check_iterator_range
-            <
-                is_convertible_to_closed<polygon>,
-                false // do not allow empty multi-polygon
-            >::apply(boost::begin(multi_polygon),
-                     boost::end(multi_polygon));
+        return !boost::empty(multi_polygon) &&  // do not allow empty multi-polygon
+            std::none_of(boost::begin(multi_polygon), boost::end(multi_polygon),
+                         []( auto const& polygon ){ 
+                             return ! is_convertible_to_closed<polygon_type>::apply(polygon); 
+                         }); 
     }
 };