xte::unroll()

Defined in header <xte/func/unroll.hpp>

Repeatedly passes an incrementing index, up to a given limit, as a template argument to a given functor.
Allows passing additional function arguments.


Definition

template<xte::uz n>
constexpr auto unroll(auto&& func, auto&&... args) XTE_ARROW(/*
	func.template operator()<0>(args...),
	func.template operator()<1>(args...),
	...,
	func.template operator()<(n - 1)>(args...)
*/)


Example

xte::unroll<5>([]<auto i> {
	std::println("{}", i);
});
Output:
0
1
2
3
4
[View in Compiler Explorer]