#pragma once #include namespace algorithm { // comp returns true if lhs is thought to be less than rhs // f(start, end) template void operate_on_set_intervals(InputIt first, InputIt last, Compare comp, F f) { if (first == last) return; for (InputIt prev_iter = first++; first != last; ++first, ++prev_iter) { if (comp(*prev_iter, *first)) f(*prev_iter, *first); } } // f(start, end) template void operate_on_set_intervals(InputIt first, InputIt last, F f) { operate_on_set_intervals(first, last, std::less>{}, f); } } // namespace algorithm