The following code example is taken from the book
The C++ Standard Library - A Tutorial and Reference
by Nicolai M. Josuttis, Addison-Wesley, 1999
© Copyright Nicolai M. Josuttis 1999
template <class Iterator>
inline long distance (Iterator pos1, Iterator pos2)
{
long d = 0;
distance (pos1, pos2, d);
return d;
}