Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
template<typename Iterator, typename Distance>
void advance(Iterator& it, Distance n, std::bidirectional_iterator_tag)
{
// Bidirectional implementation
}
template<typename Iterator, typename Distance>
void advance(Iterator& it, Distance n, std::random_access_iterator_tag)
{
// Random access implementation
}
template<typename Iterator, typename Distance>
void advance(Iterator& it, Distance n)
{
return advance(it, n, typename Iterator::iterator_category{});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment