diff --git a/sprout/algorithm/count.hpp b/sprout/algorithm/count.hpp index 2b5437ad..134e7a21 100644 --- a/sprout/algorithm/count.hpp +++ b/sprout/algorithm/count.hpp @@ -59,7 +59,9 @@ namespace sprout { { typedef sprout::pair::difference_type> type; return current.first == last ? current - : n == 1 ? type(sprout::next(current.first), current.second + (*current.first == value ? 1 : 0)) + : n == 1 ? *current.first == value + ? type(sprout::next(current.first), current.second + 1) + : type(sprout::next(current.first), current.second) : sprout::detail::count_impl_1( sprout::detail::count_impl_1( current, diff --git a/sprout/algorithm/count_if.hpp b/sprout/algorithm/count_if.hpp index 817501fe..e4bc3eaa 100644 --- a/sprout/algorithm/count_if.hpp +++ b/sprout/algorithm/count_if.hpp @@ -59,7 +59,9 @@ namespace sprout { { typedef sprout::pair::difference_type> type; return current.first == last ? current - : n == 1 ? type(sprout::next(current.first), current.second + (pred(*current.first) ? 1 : 0)) + : n == 1 ? pred(*current.first) + ? type(sprout::next(current.first), current.second + 1) + : type(sprout::next(current.first), current.second) : sprout::detail::count_if_impl_1( sprout::detail::count_if_impl_1( current, diff --git a/sprout/algorithm/is_partitioned.hpp b/sprout/algorithm/is_partitioned.hpp index 57aa34d2..5755f2a1 100644 --- a/sprout/algorithm/is_partitioned.hpp +++ b/sprout/algorithm/is_partitioned.hpp @@ -52,7 +52,7 @@ namespace sprout { typedef sprout::pair::difference_type> type; return current.second > 1 || current.first == last ? current : n == 1 ? current.second == 0 - ? type(sprout::next(current.first), pred(*current.first) ? 0 : 1) + ? pred(*current.first) ? type(sprout::next(current.first), 0) : type(sprout::next(current.first), 1) : !pred(*current.first) ? type(sprout::next(current.first), 1) : type(current.first, 2) : sprout::detail::is_partitioned_impl_1( sprout::detail::is_partitioned_impl_1( diff --git a/sprout/algorithm/one_of.hpp b/sprout/algorithm/one_of.hpp index f9e65a44..27ac7141 100644 --- a/sprout/algorithm/one_of.hpp +++ b/sprout/algorithm/one_of.hpp @@ -82,7 +82,7 @@ namespace sprout { typedef sprout::pair::difference_type> type; return current.second > 1 || current.first == last ? current : n == 1 ? current.second == 0 - ? type(sprout::next(current.first), pred(*current.first) ? 1 : 0) + ? !pred(*current.first) ? type(sprout::next(current.first), 0) : type(sprout::next(current.first), 1) : !pred(*current.first) ? type(sprout::next(current.first), 1) : type(current.first, 2) : sprout::detail::one_of_impl_1( sprout::detail::one_of_impl_1( diff --git a/sprout/algorithm/one_of_equal.hpp b/sprout/algorithm/one_of_equal.hpp index 97a1071d..c6dc2633 100644 --- a/sprout/algorithm/one_of_equal.hpp +++ b/sprout/algorithm/one_of_equal.hpp @@ -82,7 +82,7 @@ namespace sprout { typedef sprout::pair::difference_type> type; return current.second > 1 || current.first == last ? current : n == 1 ? current.second == 0 - ? type(sprout::next(current.first), *current.first == value ? 1 : 0) + ? !(*current.first == value) ? type(sprout::next(current.first), 0) : type(sprout::next(current.first), 1) : !(*current.first == value) ? type(sprout::next(current.first), 1) : type(current.first, 2) : sprout::detail::one_of_equal_impl_1( sprout::detail::one_of_equal_impl_1(