Replace reduce with bespoke implementation

If _this_ isn't `constexpr` compatible, I'm going to propose removing
support for the MacOS clang build.
This commit is contained in:
Chip Hogg
2022-03-19 17:35:20 +00:00
parent f495ad9e75
commit 6872117bae

View File

@@ -101,7 +101,11 @@ constexpr auto coprimes_up_to(std::size_t n, const std::array<std::size_t, N>& b
template<std::size_t N>
constexpr std::size_t product(const std::array<std::size_t, N>& 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.