adjacent_difference.qbk 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. [/
  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)
  5. /]
  6. [section:adjacent_difference adjacent_difference]
  7. [heading Prototype]
  8. ``
  9. template<
  10. class SinglePassRange,
  11. class OutputIterator
  12. >
  13. OutputIterator adjacent_difference(
  14. const SinglePassRange& source_rng,
  15. OutputIterator out_it);
  16. template<
  17. class SinglePassRange,
  18. class OutputIterator,
  19. class BinaryOperation
  20. >
  21. OutputIterator adjacent_difference(
  22. const SinglePassRange& source_rng,
  23. OutputIterator out_it,
  24. BinaryOperation op);
  25. ``
  26. [heading Description]
  27. `adjacent_difference` calculates the differences of adjacent_elements in `rng`.
  28. The first version of `adjacent_difference` uses `operator-()` to calculate the differences.
  29. The second version uses `BinaryOperation` instead of `operator-()`.
  30. [heading Definition]
  31. Defined in the header file `boost/range/numeric.hpp`
  32. [heading Requirements]
  33. [heading For the first version]
  34. # `SinglePassRange` is a model of the __single_pass_range__ Concept.
  35. # `OutputIterator` is a model of the `OutputIteratorConcept`.
  36. # If `x` and `y` are objects of `SinglePassRange`'s value type, then `x - y` is defined.
  37. # The value type of `SinglePassRange` is convertible to a type in `OutputIterator`'s set of value types.
  38. # The return type of `x - y` is convertible to a type in `OutputIterator`'s set of value types.
  39. [heading For the second version]
  40. # `SinglePassRange` is a model of the __single_pass_range__ Concept.
  41. # `OutputIterator` is a model of the `OutputIteratorConcept`.
  42. # `BinaryOperation` is a model of the `BinaryFunctionConcept`.
  43. # The value type of `SinglePassRange` is convertible to `BinaryOperation`'s first and second argument types.
  44. # The value type of `SinglePassRange` is convertible to a type in `OutputIterator`'s set of value types.
  45. # The result type of `BinaryOperation` is convertible to a type in `OutputIterator`'s set of value types.
  46. [heading Precondition:]
  47. `[result, result + distance(rng))` is a valid range.
  48. [heading Complexity]
  49. Linear. If `empty(rng)` then zero applications, otherwise `distance(rng) - 1` applications are performed.
  50. [endsect]