cpp/iterator/distance

Returns the number of hops from to.

Return value
The number of increments needed to go from to.

Complexity
Linear.

However, if additionally meets the requirements of, complexity is constant.

Possible implementation
See also the implementations in libstdc++ and libc++.