STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Macros | Functions
numeric File Reference
#include <xutility>

Macros

#define _NUMERIC_
 

Functions

template<class _InIt , class _Ty , class _Fn2 >
_STD_BEGIN _Ty _Accumulate (_InIt _First, _InIt _Last, _Ty _Val, _Fn2 _Func)
 
template<class _InIt , class _Ty , class _Fn2 >
_Ty accumulate (_InIt _First, _InIt _Last, _Ty _Val, _Fn2 _Func)
 
template<class _InIt , class _Ty >
_Ty accumulate (_InIt _First, _InIt _Last, _Ty _Val)
 
template<class _InIt1 , class _InIt2 , class _Ty , class _Fn21 , class _Fn22 >
_Ty _Inner_product (_InIt1 _First1, _InIt1 _Last1, _InIt2 _First2, _Ty _Val, _Fn21 _Func1, _Fn22 _Func2)
 
template<class _InIt1 , class _InIt2 , class _Ty , class _Fn21 , class _Fn22 >
_Ty inner_product (_InIt1 _First1, _InIt1 _Last1, _InIt2 _First2, _Ty _Val, _Fn21 _Func1, _Fn22 _Func2)
 
template<class _InIt1 , class _InIt2 , class _Ty >
_Ty inner_product (_InIt1 _First1, _InIt1 _Last1, _InIt2 _First2, _Ty _Val)
 
template<class _InIt , class _OutIt , class _Fn2 , class _Ty >
_OutIt _Partial_sum (_InIt _First, _InIt _Last, _OutIt _Dest, _Fn2 _Func, _Ty *)
 
template<class _InIt , class _OutIt , class _Fn2 >
_OutIt partial_sum (_InIt _First, _InIt _Last, _OutIt _Dest, _Fn2 _Func)
 
template<class _InIt , class _OutIt >
_OutIt partial_sum (_InIt _First, _InIt _Last, _OutIt _Dest)
 
template<class _InIt , class _OutIt , class _Fn2 , class _Ty >
_OutIt _Adjacent_difference (_InIt _First, _InIt _Last, _OutIt _Dest, _Fn2 _Func, _Ty *)
 
template<class _InIt , class _OutIt , class _Fn2 >
_OutIt adjacent_difference (_InIt _First, _InIt _Last, _OutIt _Dest, _Fn2 _Func)
 
template<class _InIt , class _OutIt >
_OutIt adjacent_difference (_InIt _First, _InIt _Last, _OutIt _Dest)
 
template<class _FwdIt , class _Ty >
void _Iota (_FwdIt _First, _FwdIt _Last, _Ty _Val)
 
template<class _FwdIt , class _Ty >
void iota (_FwdIt _First, _FwdIt _Last, _Ty _Val)
 

Macro Definition Documentation

#define _NUMERIC_

Function Documentation

template<class _InIt , class _Ty , class _Fn2 >
_STD_BEGIN _Ty _Accumulate ( _InIt  _First,
_InIt  _Last,
_Ty  _Val,
_Fn2  _Func 
)
inline
18  { // return sum of _Val and all in [_First, _Last), using _Func
19  for (; _First != _Last; ++_First)
20  _Val = _Func(_Val, *_First);
21  return (_Val);
22  }
_FwdIt const _Ty _Val
Definition: algorithm:1938
_FwdIt _Last
Definition: algorithm:1936
template<class _InIt , class _OutIt , class _Fn2 , class _Ty >
_OutIt _Adjacent_difference ( _InIt  _First,
_InIt  _Last,
_OutIt  _Dest,
_Fn2  _Func,
_Ty *   
)
inline
294  { // compute adjacent differences into _Dest, using _Func
295  _Ty _Val = *_First;
296  for (*_Dest = _Val; ++_First != _Last; )
297  { // compute another difference
298  _Ty _Tmp = *_First;
299  *++_Dest = _Func(_Tmp, _Val);
300  _Val = _STD move(_Tmp);
301  }
302  return (++_Dest);
303  }
_OutIt move(_InIt _First, _InIt _Last, _OutIt _Dest)
Definition: xutility:2447
_FwdIt const _Ty _Val
Definition: algorithm:1938
_FwdIt _Last
Definition: algorithm:1936
template<class _InIt1 , class _InIt2 , class _Ty , class _Fn21 , class _Fn22 >
_Ty _Inner_product ( _InIt1  _First1,
_InIt1  _Last1,
_InIt2  _First2,
_Ty  _Val,
_Fn21  _Func1,
_Fn22  _Func2 
)
inline
51  { // return inner product of sequences, using _Func1 and _Func2
52  for (; _First1 != _Last1; ++_First1, ++_First2)
53  _Val = _Func1(_Val, _Func2(*_First1, *_First2));
54  return (_Val);
55  }
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _FwdIt , class _Ty >
void _Iota ( _FwdIt  _First,
_FwdIt  _Last,
_Ty  _Val 
)
inline
417  { // compute increasing sequence into [_First, _Last)
418  for (; _First != _Last; ++_First, ++_Val)
419  *_First = _Val;
420  }
_FwdIt const _Ty _Val
Definition: algorithm:1938
_FwdIt _Last
Definition: algorithm:1936
template<class _InIt , class _OutIt , class _Fn2 , class _Ty >
_OutIt _Partial_sum ( _InIt  _First,
_InIt  _Last,
_OutIt  _Dest,
_Fn2  _Func,
_Ty *   
)
inline
173  { // compute partial sums into _Dest, using _Func
174  _Ty _Val = *_First;
175  for (*_Dest = _Val; ++_First != _Last; *++_Dest = _Val)
176  _Val = _Func(_Val, *_First);
177  return (++_Dest);
178  }
_FwdIt const _Ty _Val
Definition: algorithm:1938
_FwdIt _Last
Definition: algorithm:1936
template<class _InIt , class _Ty , class _Fn2 >
_Ty accumulate ( _InIt  _First,
_InIt  _Last,
_Ty  _Val,
_Fn2  _Func 
)
inline
28  { // return sum of _Val and all in [_First, _Last), using _Func
29  _DEBUG_RANGE(_First, _Last);
30  _DEBUG_POINTER(_Func);
31  return (_Accumulate(_Unchecked(_First), _Unchecked(_Last), _Val, _Func));
32  }
#define _DEBUG_RANGE(first, last)
Definition: xutility:467
_STD_BEGIN _Ty _Accumulate(_InIt _First, _InIt _Last, _Ty _Val, _Fn2 _Func)
Definition: numeric:17
_Iter_t _Unchecked(_Iter_t _Iter)
Definition: iterator:11
#define _DEBUG_POINTER(first)
Definition: xutility:465
_FwdIt const _Ty _Val
Definition: algorithm:1938
_FwdIt _Last
Definition: algorithm:1936
template<class _InIt , class _Ty >
_Ty accumulate ( _InIt  _First,
_InIt  _Last,
_Ty  _Val 
)
inline
38  { // return sum of _Val and all in [_First, _Last)
39  return (_STD accumulate(_First, _Last, _Val, plus<>()));
40  }
_Ty accumulate(_InIt _First, _InIt _Last, _Ty _Val, _Fn2 _Func)
Definition: numeric:27
Definition: xstddef:144
_FwdIt const _Ty _Val
Definition: algorithm:1938
_FwdIt _Last
Definition: algorithm:1936
template<class _InIt , class _OutIt , class _Fn2 >
_OutIt adjacent_difference ( _InIt  _First,
_InIt  _Last,
_OutIt  _Dest,
_Fn2  _Func 
)
inline
311  { // compute adjacent differences into _Dest, using _Func
312  return (_First == _Last ? _Dest
314  _Dest, _Func, _Val_type(_First)));
315  }
iterator_traits< _Iter >::value_type * _Val_type(_Iter)
Definition: xutility:644
_Iter_t _Unchecked(_Iter_t _Iter)
Definition: iterator:11
_OutIt _Adjacent_difference(_InIt _First, _InIt _Last, _OutIt _Dest, _Fn2 _Func, _Ty *)
Definition: numeric:292
_FwdIt _Last
Definition: algorithm:1936
template<class _InIt , class _OutIt >
_OutIt adjacent_difference ( _InIt  _First,
_InIt  _Last,
_OutIt  _Dest 
)
inline
397  { // compute adjacent differences into _Dest
398  return (_STD adjacent_difference(_First, _Last, _Dest,
399  minus<>()));
400  }
Definition: xstddef:155
_OutIt adjacent_difference(_InIt _First, _InIt _Last, _OutIt _Dest, _Fn2 _Func)
Definition: numeric:309
_FwdIt _Last
Definition: algorithm:1936
template<class _InIt1 , class _InIt2 , class _Ty , class _Fn21 , class _Fn22 >
_Ty inner_product ( _InIt1  _First1,
_InIt1  _Last1,
_InIt2  _First2,
_Ty  _Val,
_Fn21  _Func1,
_Fn22  _Func2 
)
inline
66  { // return inner product of sequences, using _Func1 and _Func2
67  _DEBUG_RANGE(_First1, _Last1);
68  _DEBUG_POINTER(_First2);
69  _DEBUG_POINTER(_Func1);
70  _DEBUG_POINTER(_Func2);
71  return (_Inner_product(_Unchecked(_First1), _Unchecked(_Last1),
72  _First2, _Val,
73  _Func1, _Func2));
74  }
#define _DEBUG_RANGE(first, last)
Definition: xutility:467
_Ty _Inner_product(_InIt1 _First1, _InIt1 _Last1, _InIt2 _First2, _Ty _Val, _Fn21 _Func1, _Fn22 _Func2)
Definition: numeric:48
_Iter_t _Unchecked(_Iter_t _Iter)
Definition: iterator:11
#define _DEBUG_POINTER(first)
Definition: xutility:465
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _InIt1 , class _InIt2 , class _Ty >
_Ty inner_product ( _InIt1  _First1,
_InIt1  _Last1,
_InIt2  _First2,
_Ty  _Val 
)
inline
148  { // return inner product of sequences
149  return (_STD inner_product(_First1, _Last1, _First2, _Val,
150  plus<>(), multiplies<>()));
151  }
Definition: xstddef:144
_Ty inner_product(_InIt1 _First1, _InIt1 _Last1, _InIt2 _First2, _Ty _Val, _Fn21 _Func1, _Fn22 _Func2)
Definition: numeric:63
Definition: xstddef:166
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _FwdIt , class _Ty >
void iota ( _FwdIt  _First,
_FwdIt  _Last,
_Ty  _Val 
)
inline
425  { // compute increasing sequence into [_First, _Last)
426  _DEBUG_RANGE(_First, _Last);
427  _Iota(_Unchecked(_First), _Unchecked(_Last), _Val);
428  }
#define _DEBUG_RANGE(first, last)
Definition: xutility:467
_Iter_t _Unchecked(_Iter_t _Iter)
Definition: iterator:11
_FwdIt const _Ty _Val
Definition: algorithm:1938
_FwdIt _Last
Definition: algorithm:1936
void _Iota(_FwdIt _First, _FwdIt _Last, _Ty _Val)
Definition: numeric:416
template<class _InIt , class _OutIt , class _Fn2 >
_OutIt partial_sum ( _InIt  _First,
_InIt  _Last,
_OutIt  _Dest,
_Fn2  _Func 
)
inline
186  { // compute partial sums into _Dest, using _Func
187  return (_First == _Last ? _Dest
189  _Dest, _Func, _Val_type(_First)));
190  }
_OutIt _Partial_sum(_InIt _First, _InIt _Last, _OutIt _Dest, _Fn2 _Func, _Ty *)
Definition: numeric:171
iterator_traits< _Iter >::value_type * _Val_type(_Iter)
Definition: xutility:644
_Iter_t _Unchecked(_Iter_t _Iter)
Definition: iterator:11
_FwdIt _Last
Definition: algorithm:1936
template<class _InIt , class _OutIt >
_OutIt partial_sum ( _InIt  _First,
_InIt  _Last,
_OutIt  _Dest 
)
inline
272  { // compute partial sums into _Dest
273  return (_STD partial_sum(_First, _Last, _Dest, plus<>()));
274  }
Definition: xstddef:144
_OutIt partial_sum(_InIt _First, _InIt _Last, _OutIt _Dest, _Fn2 _Func)
Definition: numeric:184
_FwdIt _Last
Definition: algorithm:1936