# stl_numeric.h File Reference

## Detailed Description

This is an internal header file, included by other library headers. You should not attempt to use it directly.

Definition in file stl_numeric.h.

Go to the source code of this file.

## Namespaces

- namespace std

## Defines

- #define _STL_NUMERIC_H

## Functions

- template<typename _InputIterator, typename _Tp, typename _BinaryOperation> _Tp accumulate (_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOperation __binary_op)
- template<typename _InputIterator, typename _Tp> _Tp accumulate (_InputIterator __first, _InputIterator __last, _Tp __init)
- template<typename _InputIterator, typename _OutputIterator, typename _BinaryOperation> _OutputIterator adjacent_difference (_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOperation __binary_op)
- template<typename _InputIterator, typename _OutputIterator> _OutputIterator adjacent_difference (_InputIterator __first, _InputIterator __last, _OutputIterator __result)
- template<typename _InputIterator1, typename _InputIterator2, typename _Tp, typename _BinaryOperation1, typename _BinaryOperation2> _Tp inner_product (_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init, _BinaryOperation1 __binary_op1, _BinaryOperation2 __binary_op2)
- template<typename _InputIterator1, typename _InputIterator2, typename _Tp> _Tp inner_product (_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init)
- template<typename _InputIterator, typename _OutputIterator, typename _BinaryOperation> _OutputIterator partial_sum (_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOperation __binary_op)
- template<typename _InputIterator, typename _OutputIterator> _OutputIterator partial_sum (_InputIterator __first, _InputIterator __last, _OutputIterator __result)

## Function Documentation

_Tp std::accumulate | ( | _InputIterator | __first,
|  | _InputIterator | __last,
|  | _Tp | __init,
|  | _BinaryOperation | __binary_op
| ) |

Accumulate values in a range with operation.

Accumulates the values in the range [first,last) using the function object binary_op. The initial value is init. The values are processed in order.

Parameters:

  | first | Start of range.
  | last | End of range.
  | init | Starting value to add other values to.
  | binary_op | Function object to accumulate with.

Returns:
  The final sum.

Definition at line 108 of file stl_numeric.h.

_Tp std::accumulate | ( | _InputIterator | __first,
|  | _InputIterator | __last,
|  | _Tp | __init
| ) |

Accumulate values in a range.

Accumulates the values in the range [first,last) using operator+(). The initial value is init. The values are processed in order.

Parameters:

  | first | Start of range.
  | last | End of range.
  | init | Starting value to add other values to.

Returns:
  The final sum.

Definition at line 82 of file stl_numeric.h.

_OutputIterator std::adjacent_difference | ( | _InputIterator | __first,
|  | _InputIterator | __last,
|  | _OutputIterator | __result,
|  | _BinaryOperation | __binary_op
| ) |

Return differences between adjacent values.

Computes the difference between adjacent values in the range [first,last) using the function object binary_op and writes the result to result.

Parameters:

  | first | Start of input range.
  | last | End of input range.
  | result | Output to write sums to.

Returns:
  Iterator pointing just beyond the values written to result.

Definition at line 314 of file stl_numeric.h.

_OutputIterator std::adjacent_difference | ( | _InputIterator | __first,
|  | _InputIterator | __last,
|  | _OutputIterator | __result
| ) |

Return differences between adjacent values.

Computes the difference between adjacent values in the range [first,last) using operator-() and writes the result to result.

Parameters:

  | first | Start of input range.
  | last | End of input range.
  | result | Output to write sums to.

Returns:
  Iterator pointing just beyond the values written to result.

Definition at line 275 of file stl_numeric.h.

_Tp std::inner_product | ( | _InputIterator1 | __first1,
|  | _InputIterator1 | __last1,
|  | _InputIterator2 | __first2,
|  | _Tp | __init,
|  | _BinaryOperation1 | __binary_op1,
|  | _BinaryOperation2 | __binary_op2
| ) |

Compute inner product of two ranges.

Starting with an initial value of init, applies binary_op2 to successive elements from the two ranges and accumulates each result into the accumulated value using binary_op1. The values in the ranges are processed in order.

Parameters:

  | first1 | Start of range 1.
  | last1 | End of range 1.
  | first2 | Start of range 2.
  | init | Starting value to add other values to.
  | binary_op1 | Function object to accumulate with.
  | binary_op2 | Function object to apply to pairs of input values.

Returns:
  The final inner product.

Definition at line 168 of file stl_numeric.h.

_Tp std::inner_product | ( | _InputIterator1 | __first1,
|  | _InputIterator1 | __last1,
|  | _InputIterator2 | __first2,
|  | _Tp | __init
| ) |

Compute inner product of two ranges.

Starting with an initial value of init, multiplies successive elements from the two ranges and adds each product into the accumulated value using operator+(). The values in the ranges are processed in order.

Parameters:

  | first1 | Start of range 1.
  | last1 | End of range 1.
  | first2 | Start of range 2.
  | init | Starting value to add other values to.

Returns:
  The final inner product.

Definition at line 136 of file stl_numeric.h.

_OutputIterator std::partial_sum | ( | _InputIterator | __first,
|  | _InputIterator | __last,
|  | _OutputIterator | __result,
|  | _BinaryOperation | __binary_op
| ) |

Return list of partial sums.

Accumulates the values in the range [first,last) using operator+(). As each successive input value is added into the total, that partial sum is written to result. Therefore, the first value in result is the first value of the input, the second value in result is the sum of the first and second input values, and so on.

Parameters:

  | first | Start of input range.
  | last | End of input range.
  | result | Output to write sums to.

Returns:
  Iterator pointing just beyond the values written to result.

Definition at line 239 of file stl_numeric.h.

_OutputIterator std::partial_sum | ( | _InputIterator | __first,
|  | _InputIterator | __last,
|  | _OutputIterator | __result
| ) |

Return list of partial sums.

Accumulates the values in the range [first,last) using operator+(). As each successive input value is added into the total, that partial sum is written to result. Therefore, the first value in result is the first value of the input, the second value in result is the sum of the first and second input values, and so on.

Parameters:

  | first | Start of input range.
  | last | End of input range.
  | result | Output to write sums to.

Returns:
  Iterator pointing just beyond the values written to result.

Definition at line 199 of file stl_numeric.h.