diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_circle_segment_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_circle_segment_traits_2.h index dbb909f1e52..f6fbe621739 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_circle_segment_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_circle_segment_traits_2.h @@ -584,9 +584,6 @@ public: template OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const { - typedef std::variant - Make_x_monotone_result; - // Increment the serial number of the curve cv, which will serve as its // unique identifier. unsigned int index = 0; @@ -594,10 +591,10 @@ public: if (cv.orientation() == COLLINEAR) { // The curve is a line segment. - *oi++ = Make_x_monotone_result(X_monotone_curve_2(cv.supporting_line(), - cv.source(), - cv.target(), - index)); + *oi++ = X_monotone_curve_2(cv.supporting_line(), + cv.source(), + cv.target(), + index); return oi; } @@ -608,8 +605,8 @@ public: if (sign_rad == ZERO) { // Create an isolated point. - *oi++ = Make_x_monotone_result(Point_2(circ.center().x(), - circ.center().y())); + *oi++ = Point_2(circ.center().x(), + circ.center().y()); return oi; } @@ -622,59 +619,59 @@ public: CGAL_assertion (n_vpts == 2); // Subdivide the circle into two arcs (an upper and a lower half). - *oi++ = Make_x_monotone_result(X_monotone_curve_2(circ, - vpts[0], vpts[1], - cv.orientation(), - index)); + *oi++ = X_monotone_curve_2(circ, + vpts[0], vpts[1], + cv.orientation(), + index); - *oi++ = Make_x_monotone_result(X_monotone_curve_2(circ, - vpts[1], vpts[0], - cv.orientation(), - index)); + *oi++ = X_monotone_curve_2(circ, + vpts[1], vpts[0], + cv.orientation(), + index); } else { // Act according to the number of vertical tangency points. if (n_vpts == 2) { // Subdivide the circular arc into three x-monotone arcs. - *oi++ = Make_x_monotone_result(X_monotone_curve_2(circ, - cv.source(), vpts[0], - cv.orientation(), - index)); + *oi++ = X_monotone_curve_2(circ, + cv.source(), vpts[0], + cv.orientation(), + index); - *oi++ = Make_x_monotone_result(X_monotone_curve_2(circ, - vpts[0], vpts[1], - cv.orientation(), - index)); + *oi++ = X_monotone_curve_2(circ, + vpts[0], vpts[1], + cv.orientation(), + index); - *oi++ = Make_x_monotone_result(X_monotone_curve_2(circ, - vpts[1], - cv.target(), - cv.orientation(), - index)); + *oi++ = X_monotone_curve_2(circ, + vpts[1], + cv.target(), + cv.orientation(), + index); } else if (n_vpts == 1) { // Subdivide the circular arc into two x-monotone arcs. - *oi++ = Make_x_monotone_result(X_monotone_curve_2(circ, - cv.source(), - vpts[0], - cv.orientation(), - index)); + *oi++ = X_monotone_curve_2(circ, + cv.source(), + vpts[0], + cv.orientation(), + index); - *oi++ = Make_x_monotone_result(X_monotone_curve_2(circ, - vpts[0], - cv.target(), - cv.orientation(), - index)); + *oi++ = X_monotone_curve_2(circ, + vpts[0], + cv.target(), + cv.orientation(), + index); } else { CGAL_assertion(n_vpts == 0); // The arc is already x-monotone: - *oi++ = Make_x_monotone_result(X_monotone_curve_2(circ, - cv.source(), - cv.target(), - cv.orientation(), - index)); + *oi++ = X_monotone_curve_2(circ, + cv.source(), + cv.target(), + cv.orientation(), + index); } } diff --git a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Approx_offset_base_2.h b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Approx_offset_base_2.h index ffbb4e4249f..8a9ed4a7455 100644 --- a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Approx_offset_base_2.h +++ b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Approx_offset_base_2.h @@ -168,12 +168,10 @@ protected: typename Kernel::Orientation_2 f_orient = ker.orientation_2_object(); Traits_2 traits; - std::list xobjs; - std::list::iterator xobj_it; + std::list> xobjs; typename Traits_2::Make_x_monotone_2 f_make_x_monotone = traits.make_x_monotone_2_object(); Curve_2 arc; - X_monotone_curve_2 xarc; do { @@ -517,12 +515,11 @@ protected: // convolution cycle. xobjs.clear(); f_make_x_monotone (arc, std::back_inserter(xobjs)); - for (xobj_it = xobjs.begin(); xobj_it != xobjs.end(); ++xobj_it) { - assign_success = CGAL::assign (xarc, *xobj_it); - CGAL_assertion (assign_success); - CGAL_USE(assign_success); - *oi++ = Labeled_curve_2 (xarc, - X_curve_label (xarc.is_directed_right(), + for (auto xobj_it = xobjs.begin(); xobj_it != xobjs.end(); ++xobj_it) { + const X_monotone_curve_2* xarc = std::get_if(&(*xobj_it)); + CGAL_assertion(xarc!=nullptr); + *oi++ = Labeled_curve_2 (*xarc, + X_curve_label (xarc->is_directed_right(), cycle_id, curve_index++)); } } @@ -571,18 +568,17 @@ protected: xobjs.clear(); f_make_x_monotone (arc, std::back_inserter(xobjs)); - xobj_it = xobjs.begin(); + auto xobj_it = xobjs.begin(); while (xobj_it != xobjs.end()) { - assign_success = CGAL::assign (xarc, *xobj_it); - CGAL_assertion (assign_success); - CGAL_USE(assign_success); + const X_monotone_curve_2* xarc = std::get_if(&(*xobj_it)); + CGAL_assertion (xarc != nullptr); ++xobj_it; bool is_last = (xobj_it == xobjs.end()); - *oi++ = Labeled_curve_2 (xarc, - X_curve_label (xarc.is_directed_right(), + *oi++ = Labeled_curve_2 (*xarc, + X_curve_label (xarc->is_directed_right(), cycle_id, curve_index++, is_last)); } diff --git a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Exact_offset_base_2.h b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Exact_offset_base_2.h index ca77157ec5c..2220f1f536e 100644 --- a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Exact_offset_base_2.h +++ b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Exact_offset_base_2.h @@ -117,7 +117,7 @@ protected: Algebraic a, b, c; unsigned int curve_index(0); - std::list xobjs; + std::list> xobjs; Traits_2 traits; auto nt_traits = traits.nt_traits(); @@ -127,8 +127,6 @@ protected: auto alg_ker = traits.alg_kernel(); auto f_equal = alg_ker->equal_2_object(); - bool assign_success; - do { // Get a circulator for the next vertex (in the proper orientation). if (forward) ++next; @@ -185,13 +183,11 @@ protected: f_make_x_monotone(arc, std::back_inserter(xobjs)); for (auto xobj_it = xobjs.begin(); xobj_it != xobjs.end(); ++xobj_it) { - X_monotone_curve_2 xarc; - assign_success = CGAL::assign(xarc, *xobj_it); - CGAL_assertion (assign_success); - CGAL_USE(assign_success); + const X_monotone_curve_2* xarc = std::get_if(&(*xobj_it)); + CGAL_assertion (xarc!=nullptr); - *oi++ = Labeled_curve_2(xarc, X_curve_label(xarc.is_directed_right(), - cycle_id, curve_index)); + *oi++ = Labeled_curve_2(*xarc, X_curve_label(xarc->is_directed_right(), + cycle_id, curve_index)); curve_index++; } } @@ -237,15 +233,13 @@ protected: auto xobj_it = xobjs.begin(); while (xobj_it != xobjs.end()) { - X_monotone_curve_2 xarc; - assign_success = CGAL::assign(xarc, *xobj_it); - CGAL_assertion (assign_success); - CGAL_USE(assign_success); + const X_monotone_curve_2* xarc = std::get_if(&(*xobj_it)); + CGAL_assertion (xarc!=nullptr); ++xobj_it; is_last = (xobj_it == xobjs.end()); - *oi++ = Labeled_curve_2(xarc, X_curve_label(xarc.is_directed_right(), + *oi++ = Labeled_curve_2(*xarc, X_curve_label(xarc->is_directed_right(), cycle_id, curve_index, is_last)); curve_index++;