![]() |
Home | Libraries | People | FAQ | More |
The boost::iterators::distance function template is an adapted
version of std::distance for the Boost iterator traversal
concepts.
<boost/iterator/distance.hpp>
template <typename Iterator> constexpr typename iterator_difference<Iterator>::type distance(Iterator first, Iterator last);
Computes the (signed) distance from first
to last.
Iterator should model Single Pass Iterator.
If Iterator models Random Access Traversal
Iterator, [first, last) or [last, first)
should be valid; otherwise [first, last) should
be valid.
If Iterator models Random Access Traversal
Iterator, it takes constant time; otherwise it takes linear time.
constexpr
only in C++14 or later.
Contributed by Michel Morin.