2 Copyright 2010 Neil Groves
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 [section:adjacent_difference adjacent_difference]
12 class SinglePassRange,
15 OutputIterator adjacent_difference(
16 const SinglePassRange& source_rng,
17 OutputIterator out_it);
20 class SinglePassRange,
24 OutputIterator adjacent_difference(
25 const SinglePassRange& source_rng,
26 OutputIterator out_it,
32 `adjacent_difference` calculates the differences of adjacent_elements in `rng`.
34 The first version of `adjacent_difference` uses `operator-()` to calculate the differences.
35 The second version uses `BinaryOperation` instead of `operator-()`.
39 Defined in the header file `boost/range/numeric.hpp`
41 [heading Requirements]
43 [heading For the first version]
45 # `SinglePassRange` is a model of the __single_pass_range__ Concept.
46 # `OutputIterator` is a model of the `OutputIteratorConcept`.
47 # If `x` and `y` are objects of `SinglePassRange`'s value type, then `x - y` is defined.
48 # The value type of `SinglePassRange` is convertible to a type in `OutputIterator`'s set of value types.
49 # The return type of `x - y` is convertible to a type in `OutputIterator`'s set of value types.
51 [heading For the second version]
53 # `SinglePassRange` is a model of the __single_pass_range__ Concept.
54 # `OutputIterator` is a model of the `OutputIteratorConcept`.
55 # `BinaryOperation` is a model of the `BinaryFunctionConcept`.
56 # The value type of `SinglePassRange` is convertible to `BinaryOperation`'s first and second argument types.
57 # The value type of `SinglePassRange` is convertible to a type in `OutputIterator`'s set of value types.
58 # The result type of `BinaryOperation` is convertible to a type in `OutputIterator`'s set of value types.
60 [heading Precondition:]
62 `[result, result + distance(rng))` is a valid range.
66 Linear. If `empty(rng)` then zero applications, otherwise `distance(rng) - 1` applications are performed.