1 .. Iterators/Iterator Metafunctions//distance |20
17 typedef |unspecified| type;
25 Returns the distance between ``First`` and ``Last`` iterators, that is, an
26 |Integral Constant| ``n`` such that ``advance<First,n>::type`` is
27 identical to ``Last``.
35 #include <boost/mpl/distance.hpp>
41 +---------------+---------------------------+-----------------------------------+
42 | Parameter | Requirement | Description |
43 +===============+===========================+===================================+
44 | ``First``, | |Forward Iterator| | Iterators to compute a |
45 | ``Last`` | | distance between. |
46 +---------------+---------------------------+-----------------------------------+
51 |Tag Dispatched Metafunction|
57 For any |Forward Iterator|\ s ``first`` and ``last``:
61 typedef distance<first,last>::type n;
67 [``first``, ``last``) is a valid range.
75 iterator_range<first,last>
82 ``is_same< advance<first,n>::type, last >::value == true``.
88 Amortized constant time if ``first`` and ``last`` are |Random Access Iterator|\ s,
89 otherwise linear time.
97 typedef range_c<int,0,10>::type range;
98 typedef begin<range>::type first;
99 typedef end<range>::type last;
101 BOOST_MPL_ASSERT_RELATION( (distance<first,last>::value), ==, 10);
107 |Iterators|, |Tag Dispatched Metafunction|, |advance|, |next|, |prior|
110 .. copyright:: Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams
111 Distributed under the Boost Software License, Version 1.0. (See accompanying
112 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)