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) {
15 typedef decltype((*std::declval<IteratorType>())) value_type;
18 if (its.size() == 0) {
22 bool allNonEmpty =
true;
23 for (uint64_t index = 0; index < its.size(); ++index) {
24 if (its[index] == ites[index]) {
33 std::vector<IteratorType> currentIterators(its);
36 for (uint64_t index = 0; index < currentIterators.size(); ++index) {
37 setValueCallback(index, *currentIterators[index]);
42 bool cont = newCombinationCallback();
48 for (; index < currentIterators.size(); ++index) {
49 ++currentIterators[index];
50 if (currentIterators[index] == ites[index]) {
51 currentIterators[index] = its[index];
58 if (index == currentIterators.size()) {
61 for (uint64_t j = 0; j <= index; ++j) {
62 setValueCallback(j, *currentIterators[j]);