From da8b08e4e3d7c189c11b1db6abf10926ba8373f7 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Tue, 12 Oct 2021 15:02:33 +0200 Subject: [PATCH] abacus: bignum: use IIFE I think it looks cleaner to use Immediately Invoked Function Expressions in such cases. --- src/bignum/bignum.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/bignum/bignum.cc b/src/bignum/bignum.cc index 2121cdc..6b6987e 100644 --- a/src/bignum/bignum.cc +++ b/src/bignum/bignum.cc @@ -82,12 +82,12 @@ digits_type do_addition(digits_type const& lhs, digits_type const& rhs) { ++it2; } - auto it = it1; - auto end = end1; - if (it1 == end1) { - it = it2; - end = end2; - } + auto [it, end] = [=]() { + if (it1 != end1) { + return std::make_pair(it1, end1); + } + return std::make_pair(it2, end2); + }(); while (it != end) { int addition = *it + carry;