Squashed 'third_party/boostorg/range/' content from commit 4cfd4d8

Change-Id: I641c49f21039952b16f888223a952503e43a28a9
git-subtree-dir: third_party/boostorg/range
git-subtree-split: 4cfd4d8287ca949d7f29256adf3e796a0d1775ec
diff --git a/doc/reference/numeric/accumulate.qbk b/doc/reference/numeric/accumulate.qbk
new file mode 100644
index 0000000..e151e63
--- /dev/null
+++ b/doc/reference/numeric/accumulate.qbk
@@ -0,0 +1,61 @@
+[/
+    Copyright 2010 Neil Groves
+    Distributed under the Boost Software License, Version 1.0.
+    (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+/]
+[section:accumulate accumulate]
+
+[heading Prototype]
+
+``
+template<
+    class SinglePassRange,
+    class Value
+    >
+Value accumulate(const SinglePassRange& source_rng,
+                 Value init);
+
+template<
+    class SinglePassRange,
+    class Value,
+    class BinaryOperation
+    >
+Value accumulate(const SinglePassRange& source_rng,
+                 Value init,
+                 BinaryOperation op);
+``
+
+[heading Description]
+
+`accumulate` is a generalisation of summation. It computes a binary operation (`operator+`
+in the non-predicate version) of `init` and all of the elements in `rng`.
+
+The return value is the resultant value of the above algorithm.
+
+[heading Definition]
+
+Defined in the header file `boost/range/numeric.hpp`
+
+[heading Requirements]
+
+[heading For the first version]
+
+# `SinglePassRange` is a model of the __single_pass_range__ Concept.
+# `Value` is a model of the `AssignableConcept`.
+# An `operator+` is defined for a left-hand operand of type `Value` and a right-hand operand of the `SinglePassRange` value type.
+# The return type of the above operator is convertible to `Value`.
+
+[heading For the second version]
+
+# `SinglePassRange` is a model of the __single_pass_range__ Concept.
+# `Value` is a model of the `AssignableConcept`.
+# `BinaryOperation` is a model of the `BinaryFunctionConcept`.
+# `Value` is convertible to `BinaryOperation`'s first argument type.
+# `SinglePassRange`'s value type is convertible to `BinaryOperation`'s second argument type.
+# The return type of `BinaryOperation` is convertible to `Value`.
+
+[heading Complexity]
+
+Linear. Exactly `distance(source_rng)`.
+
+[endsect]
diff --git a/doc/reference/numeric/adjacent_difference.qbk b/doc/reference/numeric/adjacent_difference.qbk
new file mode 100644
index 0000000..7580036
--- /dev/null
+++ b/doc/reference/numeric/adjacent_difference.qbk
@@ -0,0 +1,68 @@
+[/
+    Copyright 2010 Neil Groves
+    Distributed under the Boost Software License, Version 1.0.
+    (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+/]
+[section:adjacent_difference adjacent_difference]
+
+[heading Prototype]
+
+``
+template<
+    class SinglePassRange,
+    class OutputIterator
+    >
+OutputIterator adjacent_difference(
+    const SinglePassRange& source_rng,
+    OutputIterator out_it);
+
+template<
+    class SinglePassRange,
+    class OutputIterator,
+    class BinaryOperation
+    >
+OutputIterator adjacent_difference(
+    const SinglePassRange& source_rng,
+    OutputIterator out_it,
+    BinaryOperation op);
+``
+
+[heading Description]
+
+`adjacent_difference` calculates the differences of adjacent_elements in `rng`.
+
+The first version of `adjacent_difference` uses `operator-()` to calculate the differences.
+The second version uses `BinaryOperation` instead of `operator-()`.
+
+[heading Definition]
+
+Defined in the header file `boost/range/numeric.hpp`
+
+[heading Requirements]
+
+[heading For the first version]
+
+# `SinglePassRange` is a model of the __single_pass_range__ Concept.
+# `OutputIterator` is a model of the `OutputIteratorConcept`.
+# If `x` and `y` are objects of `SinglePassRange`'s value type, then `x - y` is defined.
+# The value type of `SinglePassRange` is convertible to a type in `OutputIterator`'s set of value types.
+# The return type of `x - y` is convertible to a type in `OutputIterator`'s set of value types.
+
+[heading For the second version]
+
+# `SinglePassRange` is a model of the __single_pass_range__ Concept.
+# `OutputIterator` is a model of the `OutputIteratorConcept`.
+# `BinaryOperation` is a model of the `BinaryFunctionConcept`.
+# The value type of `SinglePassRange` is convertible to `BinaryOperation`'s first and second argument types.
+# The value type of `SinglePassRange` is convertible to a type in `OutputIterator`'s set of value types.
+# The result type of `BinaryOperation` is convertible to a type in `OutputIterator`'s set of value types.
+
+[heading Precondition:]
+
+`[result, result + distance(rng))` is a valid range.
+
+[heading Complexity]
+
+Linear. If `empty(rng)` then zero applications, otherwise `distance(rng) - 1` applications are performed.
+
+[endsect]
diff --git a/doc/reference/numeric/inner_product.qbk b/doc/reference/numeric/inner_product.qbk
new file mode 100644
index 0000000..bb4fc3c
--- /dev/null
+++ b/doc/reference/numeric/inner_product.qbk
@@ -0,0 +1,73 @@
+[/
+    Copyright 2010 Neil Groves
+    Distributed under the Boost Software License, Version 1.0.
+    (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+/]
+[section:inner_product inner_product]
+
+[heading Prototype]
+
+``
+template<class SinglePassRange1,
+         class SinglePassRange2,
+         class Value>
+    Value inner_product( const SinglePassRange1& rng1,
+                         const SinglePassRange2& rng2,
+                         Value                   init );
+
+template<class SinglePassRange1,
+         class SinglePassRange2,
+         class Value,
+         class BinaryOperation1,
+         class BinaryOperation2>
+    Value inner_product( const SinglePassRange1& rng1,
+                         const SinglePassRange2& rng2,
+                         Value                   init,
+                         BinaryOperation1        op1,
+                         BinaryOperation2        op2 );
+``
+
+[heading Description]
+
+`inner_product` calculates a generalised inner product of the range `rng1` and `rng2`.
+
+For further information on the `inner_product` algorithm please see __sgi_inner_product__.
+
+[heading Definition]
+
+Defined in the header file `boost/range/numeric.hpp`
+
+[heading Requirements]
+
+[heading For the first version]
+
+# `SinglePassRange1` is a model of the __single_pass_range__ Concept.
+# `SinglePassRange2` is a model of the __single_pass_range__ Concept.
+# `Value` is a model of the `AssignableConcept`.
+# If `x` is an object of type `Value`, `y` is an object of `SinglePassRange1`'s value
+type, and `z` is an object of `SinglePassRange2`'s value type, then `x + y * z`
+is defined.
+# The result type of the expression `x + y * z` is convertible to `Value`.
+
+[heading For the second version]
+
+# `SinglePassRange1` is a model of the __single_pass_range__ Concept.
+# `SinglePassRange2` is a model of the __single_pass_range__ Concept.
+# `Value` is a model of the `AssignableConcept`.
+# `BinaryOperation1` is a model of the `BinaryFunctionConcept`.
+# `BinaryOperation2` is a model of the `BinaryFunctionConcept`.
+# The value type of `SinglePassRange1` is convertible to the first argument type of `BinaryOperation2`.
+# The value type of `SinglePassRange2` is convertible to the second argument type of `BinaryOperation2`.
+# `Value` is convertible to the value type of `BinaryOperation1`.
+# The return type of `BinaryOperation2` is convertible to the second argument type of `BinaryOperation1`.
+# The return type of `BinaryOperation1` is convertible to `Value`.
+
+[heading Precondition:]
+
+`distance(rng2) >= distance(rng1)` is a valid range.
+
+[heading Complexity]
+
+Linear. Exactly `distance(rng)`.
+
+[endsect]
diff --git a/doc/reference/numeric/partial_sum.qbk b/doc/reference/numeric/partial_sum.qbk
new file mode 100644
index 0000000..f52e465
--- /dev/null
+++ b/doc/reference/numeric/partial_sum.qbk
@@ -0,0 +1,60 @@
+[/
+    Copyright 2010 Neil Groves
+    Distributed under the Boost Software License, Version 1.0.
+    (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+/]
+[section:partial_sum partial_sum]
+
+[heading Prototype]
+
+``
+template<class SinglePassRange,
+         class OutputIterator>
+OutputIterator partial_sum(const SinglePassRange& rng,
+                           OutputIterator out_it);
+
+template<class SinglePassRange,
+         class OutputIterator,
+         class BinaryOperation>
+OutputIterator partial_sum(const SinglePassRange& rng,
+                           OutputIterator out_it,
+                           BinaryOperation op);
+``
+
+[heading Description]
+
+`partial_sum` calculates a generalised partial sum of `rng` in the same manner as
+`std::partial_sum(boost::begin(rng), boost::end(rng), out_it)`. See __sgi_partial_sum__.
+
+
+[heading Definition]
+
+Defined in the header file `boost/range/numeric.hpp`
+
+[heading Requirements]
+
+[heading For the first version]
+
+# `SinglePassRange` is a model of the __single_pass_range__ Concept.
+# `OutputIterator` is a model of the `OutputIteratorConcept`.
+# If `x` and `y` are objects of `SinglePassRange`'s value type, then `x + y` is defined.
+# The return type of `x + y` is convertible to the value type of `SinglePassRange`.
+# The value type of `SinglePassRange` is convertible to a type in `OutputIterator`'s set of value types.
+
+[heading For the second version]
+
+# `SinglePassRange` is a model of the __single_pass_range__ Concept.
+# `OutputIterator` is a model of the `OutputIteratorConcept`.
+# `BinaryOperation` is a model of the `BinaryFunctionConcept`.
+# The result type of `BinaryOperation` is convertible to the value type of `SinglePassRange`.
+# The value type of `SinglePassRange` is convertible to a type in `OutputIterator`'s set of value types.
+
+[heading Precondition:]
+
+`[result, result + distance(rng))` is a valid range.
+
+[heading Complexity]
+
+Linear. If `empty(rng)` then zero applications, otherwise `distance(rng) - 1` applications are performed.
+
+[endsect]