#ifndef FOR_EACH_INDEXED_HPP #define FOR_EACH_INDEXED_HPP #include #include #include namespace osrm::util { template void for_each_indexed(ForwardIterator first, ForwardIterator last, Function function) { for (size_t i = 0; first != last; ++first, ++i) { function(i, *first); } } template void for_each_indexed(ContainerT &container, Function function) { for_each_indexed(std::begin(container), std::end(container), function); } } // namespace osrm #endif /* FOR_EACH_INDEXED_HPP */