xieite::min_args()

Defined in header <xieite/fn/min_args.hpp>

Invokes a functor with the minimum number of arguments that it allows.
This is intended for functors with default parameters.


Declaration

[[nodiscard]] constexpr auto min_args(auto&& fn, auto&&... args)
	XIEITE_ARROW(XIEITE_LIFT(std::apply)(
		XIEITE_FWD(fn),
		xieite::subtuple<0, /*???*/>(std::make_tuple(XIEITE_FWD(args)...))
	))


Example

void foo(int x, int y = 999) {
	xieite::dump(x, y);
};

int main() {
	xieite::min_args(foo, 1, 2);
}
Output:
1 999
[View in Compiler Explorer]