12void forEach(std::vector<IteratorType>
const& its, std::vector<IteratorType>
const& ites,
13 std::function<
void(uint64_t,
decltype(*std::declval<IteratorType>()))>
const& setValueCallback,
14 std::function<
bool()>
const& newCombinationCallback) {
17 if (its.size() == 0) {
21 bool allNonEmpty =
true;
22 for (uint64_t index = 0; index < its.size(); ++index) {
23 if (its[index] == ites[index]) {
32 std::vector<IteratorType> currentIterators(its);
35 for (uint64_t index = 0; index < currentIterators.size(); ++index) {
36 setValueCallback(index, *currentIterators[index]);
41 bool cont = newCombinationCallback();
47 for (; index < currentIterators.size(); ++index) {
48 ++currentIterators[index];
49 if (currentIterators[index] == ites[index]) {
50 currentIterators[index] = its[index];
57 if (index == currentIterators.size()) {
60 for (uint64_t j = 0; j <= index; ++j) {
61 setValueCallback(j, *currentIterators[j]);