xte::unfold()

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

Passes a pack of indices of a given size as template arguments to a given functor.
Allows passing additional function arguments.


Definition

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


Example

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