3rdParty/boost/1.78.0/libs/mpl/doc/refmanual/distance.html
| Prev Next | Back Along | Up Home | Full TOC | Front Page / Iterators / Iterator Metafunctions / distance |
template<
typename First
, typename Last
>
struct[distance](./distance.html){
typedef_unspecified_type;
};
Returns the distance between First and Last iterators, that is, an Integral Constant n such that advance<First,n>::type is identical to Last.
#include <[boost/mpl/distance.hpp](../../../../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](./distance.html)<first,last>::type n;
| Return type: |
| | Precondition: |
[first, last) is a valid range.
| | Semantics: |
Equivalent to
typedef[iter\_fold](./iter-fold.html)<[iterator\_range](./iterator-range.html)<first,last>
,[long\_](./long.html)<0>
,[next](./next.html)<[\_1](./placeholders.html)>
>::type n;
| | Postcondition: |
is_same< advance<first,n>::type, last >::value == true.
|
Amortized constant time if first and last are Random Access Iterators, otherwise linear time.
typedef[range\_c](./range-c.html)<int,0,10>::type range;
typedef[begin](./begin.html)<range>::type first;
typedef[end](./end.html)<range>::type last;[BOOST\_MPL\_ASSERT\_RELATION](./assert-relation.html)( ([distance](./distance.html)<first,last>::value), ==, 10);
Iterators, Tag Dispatched Metafunction, advance, next, prior
| Prev Next | Back Along | Up Home | Full TOC |
Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |