...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Front Page / Iterators / Iterator Metafunctions / distance |
Returns the distance between First and Last iterators, that is, an
Integral Constant n such that advance
#include <boost/mpl/distance.hpp>
Parameter | Requirement | Description |
---|---|---|
First, Last | Forward Iterator | Iterators to compute a distance between. |
For any Forward Iterators first and last:
typedef distance::type n;
Return type: | |
---|---|
Precondition: | [first, last) is a valid range. |
Semantics: | Equivalent to typedef iter_fold< iterator_range |
Postcondition: | is_same< advance |
Amortized constant time if first and last are Random Access Iterators, otherwise linear time.