xieite::distr_args()

Defined in fragment xieite:distr_args
(header-only: <xieite/fn/distr_args.hpp>)


Uniformly distributes arguments across multiple calls to a functor.


Declaration

template<std::size_t arity, typename F, typename... Args>
requires(xieite::type_list<xieite::any>::repeat<arity>::prepend<F>::to<std::is_invocable>::value)
constexpr void distr_args(F&& fn, Args&&... args)
noexcept(xieite::type_list<xieite::any>::repeat<arity>::prepend<F>::to<std::is_nothrow_invocable>::value);
Internally checks that arguments are evenly distributable across functor calls with static_assert().


Example

import std;
import xieite;

int main() {
	auto fn = [](int a, int b) {
		xieite::dump(a, b);
	};

	xieite::distr_args<2>(fn, 1, 2, 3, 4, 5, 6);
}
Output:
1 2
3 4
5 6