• 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=======
7advance
8=======
9
10``boost::iterators::advance`` is an adapted version of ``std::advance`` for
11the Boost iterator traversal concepts.
12
13
14Header
15------
16
17``<boost/iterator/advance.hpp>``
18
19
20Synopsis
21--------
22
23::
24
25    template <typename Iterator, typename Distance>
26    constexpr void advance(Iterator& it, Distance n);
27
28
29Description
30-----------
31
32Moves ``it`` forward by ``n`` increments
33(or backward by ``|n|`` decrements if ``n`` is negative).
34
35
36Requirements
37------------
38
39``Iterator`` should model Incrementable Iterator.
40
41
42Preconditions
43-------------
44
45Let ``it``\ :sub:`i` be the iterator obtained by incrementing
46(or decrementing if ``n`` is negative) ``it`` by *i*. All the iterators
47``it``\ :sub:`i` for *i* = 0, 1, 2, ..., ``|n|`` should be valid.
48
49If ``Iterator`` does not model Bidirectional Traversal Iterator,
50``n`` should be non-negative.
51
52
53Complexity
54----------
55
56If ``Iterator`` models Random Access Traversal Iterator, it takes constant time;
57otherwise it takes linear time.
58
59
60Notes
61-----
62
63- This function is not a customization point and is protected against
64  being found by argument-dependent lookup (ADL).
65- This function is ``constexpr`` only in C++14 or later.
66
67
68--------------------------------------------------------------------------------
69
70| Author: Michel Morin
71| Copyright |C| 2017 Michel Morin
72| Distributed under the `Boost Software License, Version 1.0
73  <http://www.boost.org/LICENSE_1_0.txt>`_.
74
75.. |C| unicode:: U+00A9 .. COPYRIGHT SIGN
76