From bd513f4b92b4407ddc68e756122102c8d197cad9 Mon Sep 17 00:00:00 2001 From: Marcel Date: Fri, 28 Aug 2020 09:22:52 +0200 Subject: [PATCH] [MISC] pairwise_combine: compute size only once (#2059) * [MISC pairwise_combine: compute size only once Co-authored-by: rrahn --- include/seqan3/range/views/pairwise_combine.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/seqan3/range/views/pairwise_combine.hpp b/include/seqan3/range/views/pairwise_combine.hpp index 14d83c6cb6..4afdc8e38e 100644 --- a/include/seqan3/range/views/pairwise_combine.hpp +++ b/include/seqan3/range/views/pairwise_combine.hpp @@ -219,7 +219,8 @@ class pairwise_combine_view : public std::ranges::view_interface //!\endcond { - return (std::ranges::size(u_range) * (std::ranges::size(u_range) - 1) / 2); + auto const size = std::ranges::size(u_range); + return (size * (size - 1)) / 2; } //!\}