From baed4103a069a6d06951ae06cf23c9ef2a31de73 Mon Sep 17 00:00:00 2001 From: Bjorn Reese Date: Sun, 12 Feb 2017 15:08:25 +0100 Subject: [PATCH] Optimized calculation of container sizes --- include/boost/core/lightweight_test.hpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/include/boost/core/lightweight_test.hpp b/include/boost/core/lightweight_test.hpp index 908cc77..b4b59c7 100644 --- a/include/boost/core/lightweight_test.hpp +++ b/include/boost/core/lightweight_test.hpp @@ -223,16 +223,8 @@ void test_all_eq_impl(FormattedOutputFunction& output, ++error_count; } while (first_it != first_end); - while (first_it != first_end) - { - ++first_it; - ++first_index; - } - while (second_it != second_end) - { - ++second_it; - ++second_index; - } + first_index += std::distance(first_it, first_end); + second_index += std::distance(second_it, second_end); if (first_index != second_index) { if (error_count == 0)