From 6872117bae6bf63de8ab86e89c3875f53675fa85 Mon Sep 17 00:00:00 2001 From: Chip Hogg Date: Sat, 19 Mar 2022 17:35:20 +0000 Subject: [PATCH] Replace `reduce` with bespoke implementation If _this_ isn't `constexpr` compatible, I'm going to propose removing support for the MacOS clang build. --- src/core/include/units/bits/prime.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/include/units/bits/prime.h b/src/core/include/units/bits/prime.h index 648dcce8..585a3b50 100644 --- a/src/core/include/units/bits/prime.h +++ b/src/core/include/units/bits/prime.h @@ -101,7 +101,11 @@ constexpr auto coprimes_up_to(std::size_t n, const std::array& b template constexpr std::size_t product(const std::array& values) { - return std::reduce(values.begin(), values.end(), std::size_t{1}, std::multiplies{}); + std::size_t product = 1; + for (const auto& v : values) { + product *= v; + } + return product; } // A configurable instantiation of the "wheel factorization" algorithm [1] for prime numbers.