Skip to content

Algorithms API

Generic algorithms optimized for packed data.

#include <pfc/algorithms.hpp>

Transform

template<typename InputIt, typename OutputIt, typename F>
OutputIt packed_transform(InputIt first, InputIt last,
                         OutputIt d_first, F&& func);

Filter

template<typename InputIt, typename OutputIt, typename Pred>
OutputIt packed_filter(InputIt first, InputIt last,
                      OutputIt d_first, Pred&& pred);

Reduce

template<typename InputIt, typename T, typename BinaryOp>
T packed_reduce(InputIt first, InputIt last,
               T init, BinaryOp&& op);

Parallel Execution

With TBB support:

#include <execution>

auto result = packed_transform(
    std::execution::par_unseq,
    data.begin(), data.end(),
    output.begin(),
    [](auto x) { return expensive_compute(x); }
);

See API Overview for complete documentation.