From d2da417b45998280aa821e1a32be8988fc51b4e5 Mon Sep 17 00:00:00 2001 From: Ophir Setter Date: Mon, 4 May 2009 08:04:20 +0000 Subject: [PATCH] using std::distance and std::advance instead of counting --- .../CGAL/Envelope_2/Env_divide_and_conquer_2_impl.h | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Envelope_2/include/CGAL/Envelope_2/Env_divide_and_conquer_2_impl.h b/Envelope_2/include/CGAL/Envelope_2/Env_divide_and_conquer_2_impl.h index c7507e2f147..7d331bae62e 100644 --- a/Envelope_2/include/CGAL/Envelope_2/Env_divide_and_conquer_2_impl.h +++ b/Envelope_2/include/CGAL/Envelope_2/Env_divide_and_conquer_2_impl.h @@ -70,16 +70,9 @@ _construct_envelope_non_vertical (Curve_pointer_iterator begin, else { // Divide the given range of curves into two. + std::size_t size = std::distance(begin, end); Curve_pointer_iterator div_it = begin; - unsigned int count = 0; - - for (iter = begin; iter != end; ++iter) - { - if (count % 2 == 0) - ++div_it; - - count++; - } + std::advance(div_it, size / 2); // Construct the diagrams (envelopes) for the two sub-ranges recursively // and then merge the two diagrams to obtain the result.