xieite ::unroll ()
Defined in fragment xieite :unroll
(header-only:
<xieite/fn/unroll.hpp>
)
Unrolls a constant-sized loop using
std ::integer_sequence
utilities.Passes the indices to a given functor as a NTTP pack.
Declarations
#0Unrolls for some constant integer.template <std ::integral auto n >constexpr auto unroll (auto&& fn ,auto&&... args )XIEITE_ARROW (/* XIEITE_FWD(fn).template operator()<0, 1, 2, ..., n>(XIEITE_FWD(args)...) */ )
#1
Unrolls for the number of types passed.template <typename... Ts >constexpr auto unroll (auto&& fn ,auto&&... args )XIEITE_ARROW (xieite ::unroll <sizeof... (Ts )>(XIEITE_FWD (fn ),XIEITE_FWD (args )...))
Example
Output:import xieite ;int main () {xieite ::unroll <5 >([]<int... i > {xieite ::dump (i ...); }); }
View in Compiler Explorer0 1 2 3 4