Skip to content

Function apply

function apply(Fn &&, const vec<T, N> &, Args &&...) simd

template <typename T, size_t N, typename Fn, typename... Args,
          typename Tout = std::invoke_result_t<Fn, T, subtype<std::decay_t<Args>>...>>
constexpr KFR_INTRINSIC vec<Tout, N> apply(Fn&& fn, const vec<T, N>& arg, Args&&... args) { … }

Apply a scalar function element-wise to a vector.

Parameters
fn Callable Tout(T, Args...) .
arg Input vector.
args Extra arguments forwarded to every call.
Returns
Vector of results.

Fully qualified name: kfr::apply(Fn &&, const vec<T, N> &, Args &&...)

Declared at simd/vec.hpp:1628

Function apply

function apply(Fn &&, const T &, Args &&...) simd

template <typename T, typename Fn, typename... Args,
          typename Tout = std::invoke_result_t<Fn, T, std::decay_t<Args>...>>
    requires(std::is_same_v<T, subtype<T>>)
constexpr KFR_INTRINSIC Tout apply(Fn&& fn, const T& arg, Args&&... args) { … }

Apply a function to a scalar (pass-through overload).

Returns
fn(arg, args...) .

Fully qualified name: kfr::apply(Fn &&, const T &, Args &&...)

Declared at simd/vec.hpp:1640

Function apply

function apply(Fn &&) simd

template <size_t N, typename Fn, typename T = std::invoke_result_t<Fn>>
constexpr KFR_INTRINSIC vec<T, N> apply(Fn&& fn) { … }

Generate a vector by calling a nullary function N times.

Returns
vec<T, N> where T is the result type of fn .

Fully qualified name: kfr::apply(Fn &&)

Declared at simd/vec.hpp:1650

This file was generated by cxxdox, a C++ documentation generator based on MkDocs Material and libclang.