xte::fold<>

Defined in header <xte/meta/fold.hpp>

Recursively calls a functor, additionally passing an index, using a fold expression.


Definition

template<decltype(auto) func, decltype(auto) x, xte::uz n>
constexpr decltype(auto) fold = /*
	func.operator()<
		func.operator()<
			func.operator()<
				func.operator()<
					x,
					0
				>(),
				1
			>(),
			...
		>(),
		(n - 1)
	>()
*/;



Example

constexpr auto add_ptr = []<auto x, auto> { return ^^typename[:x:]*; };

static_assert(^^int*** == xte::fold<add_ptr, ^^int, 3>);
[View in Compiler Explorer]