|
|
|
|
|
by Erlangen
27 days ago
|
|
You said "ranges and algorithms", but you didn't copy the third function which actually uses <range> library. inline double ranges_pipeline(std::span<double const> xs) noexcept {
auto costs = xs
| std::views::transform(calibrated_mv)
| std::views::transform(residual)
| std::views::transform(weighted_square); return std::ranges::fold_left(costs, 0.0, std::plus<double>{});
}It's still a bit verbose, because C++ doesn't allow universal function call syntax. It will be even more concise in other languages like D. |
|