• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. Copyright (C) 2017 Michel Morin.
2   Distributed under the Boost Software License, Version 1.0.
3   (See accompanying file LICENSE_1_0.txt or copy at
4   http://www.boost.org/LICENSE_1_0.txt)
5
6========
7distance
8========
9
10``boost::iterators::distance`` is an adapted version of ``std::distance`` for
11the Boost iterator traversal concepts.
12
13
14Header
15------
16
17``<boost/iterator/distance.hpp>``
18
19
20Synopsis
21--------
22
23::
24
25    template <typename Iterator>
26    constexpr typename iterator_difference<Iterator>::type
27    distance(Iterator first, Iterator last);
28
29
30Description
31-----------
32
33Computes the (signed) distance from ``first`` to ``last``.
34
35
36Requirements
37------------
38
39``Iterator`` should model Single Pass Iterator.
40
41
42Preconditions
43-------------
44
45If ``Iterator`` models Random Access Traversal Iterator,
46``[first, last)`` or ``[last, first)`` should be valid;
47otherwise ``[first, last)`` should be valid.
48
49
50Complexity
51----------
52
53If ``Iterator`` models Random Access Traversal Iterator, it takes constant time;
54otherwise it takes linear time.
55
56
57Notes
58-----
59
60- This function is not a customization point and is protected against
61  being found by argument-dependent lookup (ADL).
62- This function is ``constexpr`` only in C++14 or later.
63
64
65--------------------------------------------------------------------------------
66
67| Author: Michel Morin
68| Copyright |C| 2017 Michel Morin
69| Distributed under the `Boost Software License, Version 1.0
70  <http://www.boost.org/LICENSE_1_0.txt>`_.
71
72.. |C| unicode:: U+00A9 .. COPYRIGHT SIGN
73