ReactOS  0.4.14-dev-323-g6fe6a88
_numeric.c File Reference
#include <stl/_numeric.h>
Include dependency graph for _numeric.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _STLP_NUMERIC_C
 

Functions

template<class _InputIterator , class _OutputIterator , class _Tp , class _BinaryOperation >
_STLP_BEGIN_NAMESPACE _STLP_MOVE_TO_PRIV_NAMESPACE _OutputIterator __partial_sum (_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Tp *, _BinaryOperation __binary_op)
 
template<class _InputIterator , class _OutputIterator , class _Tp , class _BinaryOperation >
_OutputIterator __adjacent_difference (_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Tp *, _BinaryOperation __binary_op)
 
template<class _Tp , class _Integer , class _MonoidOperation >
_Tp __power (_Tp __x, _Integer __n, _MonoidOperation __opr)
 

Macro Definition Documentation

◆ _STLP_NUMERIC_C

#define _STLP_NUMERIC_C

Definition at line 27 of file _numeric.c.

Function Documentation

◆ __adjacent_difference()

template<class _InputIterator , class _OutputIterator , class _Tp , class _BinaryOperation >
_OutputIterator __adjacent_difference ( _InputIterator  __first,
_InputIterator  __last,
_OutputIterator  __result,
_Tp *  ,
_BinaryOperation  __binary_op 
)

Definition at line 57 of file _numeric.c.

59  {
60  _STLP_DEBUG_CHECK(__check_range(__first, __last))
61  if (__first == __last) return __result;
62  *__result = *__first;
63  _Tp __val = *__first;
64  while (++__first != __last) {
65  _Tp __tmp = *__first;
66  *++__result = __binary_op(__tmp, __val);
67  __val = __tmp;
68  }
69  return ++__result;
70 }
_STLP_INLINE_LOOP _InputIter __last
Definition: _algo.h:68
_STLP_INLINE_LOOP _InputIter const _Tp & __val
Definition: _algobase.h:656
#define _STLP_DEBUG_CHECK(expr)
Definition: _debug.h:440

Referenced by adjacent_difference().

◆ __partial_sum()

template<class _InputIterator , class _OutputIterator , class _Tp , class _BinaryOperation >
_STLP_BEGIN_NAMESPACE _STLP_MOVE_TO_PRIV_NAMESPACE _OutputIterator __partial_sum ( _InputIterator  __first,
_InputIterator  __last,
_OutputIterator  __result,
_Tp *  ,
_BinaryOperation  __binary_op 
)

Definition at line 40 of file _numeric.c.

41  {
42  _STLP_DEBUG_CHECK(__check_range(__first, __last))
43  if (__first == __last) return __result;
44  *__result = *__first;
45 
46  _Tp __val = *__first;
47  while (++__first != __last) {
48  __val = __binary_op(__val, *__first);
49  *++__result = __val;
50  }
51  return ++__result;
52 }
_STLP_INLINE_LOOP _InputIter __last
Definition: _algo.h:68
_STLP_INLINE_LOOP _InputIter const _Tp & __val
Definition: _algobase.h:656
#define _STLP_DEBUG_CHECK(expr)
Definition: _debug.h:440

Referenced by partial_sum().

◆ __power()

template<class _Tp , class _Integer , class _MonoidOperation >
_Tp __power ( _Tp  __x,
_Integer  __n,
_MonoidOperation  __opr 
)

Definition at line 74 of file _numeric.c.

74  {
76  if (__n == 0)
77  return __identity_element(__opr);
78  else {
79  while ((__n & 1) == 0) {
80  __n >>= 1;
81  __x = __opr(__x, __x);
82  }
83  _Tp __result = __x;
85  __n >>= 1;
86  while (__n != 0) {
87  __x = __opr(__x, __x);
88  if ((__n & 1) != 0)
89  __result = __opr(__result, __x);
90  __n >>= 1;
91  }
92  return __result;
94  }
95  _STLP_MPWFIX_CATCH_ACTION(__x = _Tp())
96 }
return __n
Definition: _algo.h:75
_Tp __identity_element(plus< _Tp >)
#define _STLP_MPWFIX_TRY
Definition: _apple.h:110
#define _STLP_MPWFIX_CATCH_ACTION(action)
Definition: _apple.h:112
#define _STLP_MPWFIX_CATCH
Definition: _apple.h:111

Referenced by __power(), power(), powT(), and rope< _CharT, _Alloc >::rope().