diff --git a/Snap_rounding_2/include/CGAL/Float_snap_rounding_2.h b/Snap_rounding_2/include/CGAL/Float_snap_rounding_2.h index 7be03b379f8..a7cdbb9e420 100644 --- a/Snap_rounding_2/include/CGAL/Float_snap_rounding_2.h +++ b/Snap_rounding_2/include/CGAL/Float_snap_rounding_2.h @@ -29,11 +29,11 @@ namespace Box_intersection_d { template class Box_with_index_d: public Box_d< NT_, N, ID_EXPLICIT> { protected: - size_t m_index; + std::size_t m_index; public: typedef Box_d< NT_, N, ID_EXPLICIT> Base; typedef NT_ NT; - typedef size_t ID; + typedef std::size_t ID; Box_with_index_d() {} Box_with_index_d( ID i) : m_index(i) {} @@ -47,8 +47,7 @@ public: } template -void double_snap_rounding_2_disjoint(PointsRange &pts, - PolylineRange &polylines) +void double_snap_rounding_2_disjoint(PointsRange &pts, PolylineRange &polylines) { using Point_2 = std::remove_cv_t::value_type>; using Kernel = typename Kernel_traits::Kernel; @@ -58,20 +57,20 @@ void double_snap_rounding_2_disjoint(PointsRange &pts, using PBox = CGAL::Box_intersection_d::Box_with_index_d; using SBox = CGAL::Box_intersection_d::Box_with_index_d; - auto comp_by_x=[&](size_t ai, size_t bi){ + auto comp_by_x=[&](std::size_t ai, std::size_t bi){ return compare(pts[ai].x(),pts[bi].x())==SMALLER; }; - auto comp_by_y=[&](size_t ai, size_t bi){ + auto comp_by_y=[&](std::size_t ai, std::size_t bi){ return compare(pts[ai].y(),pts[bi].y())==SMALLER; }; // Total order is required to using set - auto comp_by_x_first=[&](size_t ai, size_t bi){ + auto comp_by_x_first=[&](std::size_t ai, std::size_t bi){ Comparison_result res=compare(pts[ai].x(),pts[bi].x()); if(res==EQUAL) return compare(pts[ai].y(),pts[bi].y())==SMALLER; return res==SMALLER; }; - auto comp_by_y_first=[&](size_t ai, size_t bi){ + auto comp_by_y_first=[&](std::size_t ai, std::size_t bi){ Comparison_result res=compare(pts[ai].y(),pts[bi].y()); if(res==EQUAL) return compare(pts[ai].x(),pts[bi].x())==SMALLER; @@ -85,11 +84,11 @@ void double_snap_rounding_2_disjoint(PointsRange &pts, // Sorted the points may perform exact computations and thus refine the intervals of the coordinates values // This refine ensures that the order of the points will be preserved when rounded // However, except for this reason these sets are unused - using Iterator_set_x = typename std::set::iterator; - using Iterator_set_y = typename std::set::iterator; - std::set p_sort_by_x(comp_by_x_first); - std::set p_sort_by_y(comp_by_y_first); - for(size_t i=0; i!=pts.size(); ++i) + using Iterator_set_x = typename std::set::iterator; + using Iterator_set_y = typename std::set::iterator; + std::set p_sort_by_x(comp_by_x_first); + std::set p_sort_by_y(comp_by_y_first); + for(std::size_t i=0; i!=pts.size(); ++i) { p_sort_by_x.insert(i); p_sort_by_y.insert(i); @@ -98,9 +97,9 @@ void double_snap_rounding_2_disjoint(PointsRange &pts, //Prepare boxes for box_intersection_d std::vector points_boxes; std::vector segs_boxes; - for(size_t i=0; i unique_points(p_sort_by_x.begin(),p_sort_by_x.end()); + std::vector< std::size_t > unique_points(p_sort_by_x.begin(),p_sort_by_x.end()); std::sort(unique_points.begin(),unique_points.end(),comp_by_x_first); std::vector new_pts; - std::vector old_to_new_index(pts.size()); - for(size_t i=0; i!=pts.size(); ++i){ + std::vector old_to_new_index(pts.size()); + for(std::size_t i=0; i!=pts.size(); ++i){ if(i==0 || (pts[unique_points[i]]!=pts[unique_points[i-1]])) new_pts.push_back(pts[unique_points[i]]); old_to_new_index[unique_points[i]]=new_pts.size()-1; @@ -202,9 +201,9 @@ void double_snap_rounding_2_disjoint(PointsRange &pts, std::swap(pts, new_pts); for (auto& polyline : polylines) { - std::vector updated_polyline; - for (size_t i=0; i updated_polyline; + for (std::size_t i=0; i updated_polyline; + std::vector updated_polyline; updated_polyline.push_back(poly[0]); - for(size_t i=1; i!=poly.size(); ++i){ + for(std::size_t i=1; i!=poly.size(); ++i){ if(pts[poly[i-1]].x()==pts[poly[i]].x()){ Iterator_set_x start, end; // Get all vertices between the two endpoints along x order @@ -290,7 +289,7 @@ typename OutputContainer::iterator double_snap_rounding_2(InputIterator input_ std::set unique_point_set; std::map point_to_index; std::vector pts; - std::vector< std::vector< size_t> > polylines; + std::vector< std::vector< std::size_t> > polylines; // Transform range of the segments in the range of points and polyline of indexes for(typename std::vector::iterator it=segs.begin(); it!=segs.end(); ++it) @@ -312,8 +311,8 @@ typename OutputContainer::iterator double_snap_rounding_2(InputIterator input_ for(InputIterator it=segs.begin(); it!=segs.end(); ++it) { - size_t index1 = point_to_index[it->source()]; - size_t index2 = point_to_index[it->target()]; + std::size_t index1 = point_to_index[it->source()]; + std::size_t index2 = point_to_index[it->target()]; polylines.push_back({index1, index2}); } @@ -328,7 +327,7 @@ typename OutputContainer::iterator double_snap_rounding_2(InputIterator input_ output.clear(); for(auto &poly: polylines){ Polyline new_line; - for(size_t pi: poly) + for(std::size_t pi: poly) new_line.push_back(pts[pi]); output.push_back(new_line); } @@ -360,7 +359,7 @@ typename OutputContainer::iterator compute_snap_subcurves_2(InputIterator inpu std::set unique_point_set; std::map point_to_index; std::vector pts; - std::vector< std::vector< size_t> > polylines; + std::vector< std::vector< std::size_t> > polylines; for(typename std::vector::iterator it=segs.begin(); it!=segs.end(); ++it) { @@ -381,8 +380,8 @@ typename OutputContainer::iterator compute_snap_subcurves_2(InputIterator inpu for(InputIterator it=segs.begin(); it!=segs.end(); ++it) { - size_t index1 = point_to_index[it->source()]; - size_t index2 = point_to_index[it->target()]; + std::size_t index1 = point_to_index[it->source()]; + std::size_t index2 = point_to_index[it->target()]; polylines.push_back({index1, index2}); } @@ -394,10 +393,10 @@ typename OutputContainer::iterator compute_snap_subcurves_2(InputIterator inpu #endif // Output a range of segments while removing duplicate ones - std::set< std::pair > set_out_segs; + std::set< std::pair > set_out_segs; output.clear(); for(auto &poly: polylines){ - for(size_t i=1; i