| 71 | // Scalar parameters are accepted too. |
| 72 | template <typename F, typename ...P> requires detail::ValidOperands<P...> |
| 73 | [[nodiscard]] constexpr auto applyElementwise( F&& func, P&&... params ) -> typename detail::VecFromSize<detail::CommonVecSize<P...>::value>::type |
| 74 | { |
| 75 | constexpr int n = detail::CommonVecSize<P...>::value; |
| 76 | typename detail::VecFromSize<n>::type ret; |
| 77 | for (int i = 0; i < n; i++) |
| 78 | getElem( i, ret ) = func( getElem( i, params )... ); |
| 79 | return ret; |
| 80 | } |
| 81 | |
| 82 | // Reduces a vector over a binary `func`. |
| 83 | template <typename F, detail::VectorOrScalarMaybeCvref T> |