| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | POLYFLOAT - Extended precision floating points | ||
| 3 | Copyright : POLYFLOAT Contributors & Maintainers | ||
| 4 | SPDX-License-Identifier: BSL-1.0 | ||
| 5 | */ | ||
| 6 | //====================================================================================================================== | ||
| 7 | #pragma once | ||
| 8 | |||
| 9 | namespace plf::_ | ||
| 10 | { | ||
| 11 | // if the `pedantic` option is satisfied and any satisfies the predicate test, value is returned else r. | ||
| 12 | // | ||
| 13 | // This is used in manhattan, sum_of_squares, hypot and lpnorm. | ||
| 14 | 130 | template<typename O, typename T, typename... Ts> auto force_if_any(O, T r, auto test, auto value, Ts... ts) | |
| 15 | { | ||
| 16 | if constexpr (O::contains(pedantic)) | ||
| 17 | { | ||
| 18 | auto found = (test(ts) || ...); | ||
| 19 | return plf::if_else(found, value, r); | ||
| 20 | } | ||
| 21 | 130 | else return r; | |
| 22 | } | ||
| 23 | |||
| 24 | } | ||
| 25 |