EleFits  5.0.0
A modern C++ API on top of CFITSIO

◆ apply()

TDerived & apply ( TFunc &&  func,
const TContainers &...  args 
)

Apply a function with optional input containers.

Parameters
funcThe function
argsThe arguments in the form of containers of compatible sizes

If there are n arguments, func takes n+1 parameters, where the first argument is the element of this container. For example, here is how to imlement in-place element-wise square root and multiplication:

Container a = ...;
Container res = ...;
res.apply([](auto v) { return std::sqrt(v); }); // res = sqrt(res)
res.apply([](auto v, auto w) { return v * w; }, a); // res *= a
T sqrt(T... args)