ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

_numeric.h
Go to the documentation of this file.
00001 /*
00002  *
00003  * Copyright (c) 1994
00004  * Hewlett-Packard Company
00005  *
00006  * Copyright (c) 1996,1997
00007  * Silicon Graphics Computer Systems, Inc.
00008  *
00009  * Copyright (c) 1999
00010  * Boris Fomitchev
00011  *
00012  * This material is provided "as is", with absolutely no warranty expressed
00013  * or implied. Any use is at your own risk.
00014  *
00015  * Permission to use or copy this software for any purpose is hereby granted
00016  * without fee, provided the above notices are retained on all copies.
00017  * Permission to modify the code and to distribute modified code is granted,
00018  * provided the above notices are retained, and a notice that the code was
00019  * modified is included with the above copyright notice.
00020  *
00021  */
00022 
00023 /* NOTE: This is an internal header file, included by other STL headers.
00024  *   You should not attempt to use it directly.
00025  */
00026 
00027 #ifndef _STLP_INTERNAL_NUMERIC_H
00028 #define _STLP_INTERNAL_NUMERIC_H
00029 
00030 #ifndef _STLP_INTERNAL_FUNCTION_BASE_H
00031 # include <stl/_function_base.h>
00032 #endif
00033 
00034 #ifndef _STLP_INTERNAL_ITERATOR_BASE_H
00035 #  include <stl/_iterator_base.h>
00036 #endif
00037 
00038 _STLP_BEGIN_NAMESPACE
00039 
00040 template <class _InputIterator, class _Tp>
00041 _STLP_INLINE_LOOP
00042 _Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp _Init) {
00043   _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
00044   for ( ; __first != __last; ++__first)
00045     _Init = _Init + *__first;
00046   return _Init;
00047 }
00048 
00049 template <class _InputIterator, class _Tp, class _BinaryOperation>
00050 _STLP_INLINE_LOOP
00051 _Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp _Init,
00052                _BinaryOperation __binary_op) {
00053   _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
00054   for ( ; __first != __last; ++__first)
00055     _Init = __binary_op(_Init, *__first);
00056   return _Init;
00057 }
00058 
00059 template <class _InputIterator1, class _InputIterator2, class _Tp>
00060 _STLP_INLINE_LOOP
00061 _Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1,
00062                   _InputIterator2 __first2, _Tp _Init) {
00063   _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
00064   for ( ; __first1 != __last1; ++__first1, ++__first2)
00065     _Init = _Init + (*__first1 * *__first2);
00066   return _Init;
00067 }
00068 
00069 template <class _InputIterator1, class _InputIterator2, class _Tp,
00070           class _BinaryOperation1, class _BinaryOperation2>
00071 _STLP_INLINE_LOOP
00072 _Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1,
00073                   _InputIterator2 __first2, _Tp _Init,
00074                   _BinaryOperation1 __binary_op1,
00075                   _BinaryOperation2 __binary_op2) {
00076   _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
00077   for ( ; __first1 != __last1; ++__first1, ++__first2)
00078     _Init = __binary_op1(_Init, __binary_op2(*__first1, *__first2));
00079   return _Init;
00080 }
00081 
00082 _STLP_MOVE_TO_PRIV_NAMESPACE
00083 
00084 template <class _InputIterator, class _OutputIterator, class _Tp,
00085           class _BinaryOperation>
00086 _OutputIterator
00087 __partial_sum(_InputIterator __first, _InputIterator __last,
00088               _OutputIterator __result, _Tp*, _BinaryOperation __binary_op);
00089 
00090 _STLP_MOVE_TO_STD_NAMESPACE
00091 
00092 template <class _InputIterator, class _OutputIterator>
00093 inline _OutputIterator
00094 partial_sum(_InputIterator __first, _InputIterator __last,
00095             _OutputIterator __result) {
00096   return _STLP_PRIV __partial_sum(__first, __last, __result, _STLP_VALUE_TYPE(__first, _InputIterator),
00097                                   _STLP_PRIV __plus(_STLP_VALUE_TYPE(__first, _InputIterator)));
00098 }
00099 
00100 template <class _InputIterator, class _OutputIterator, class _BinaryOperation>
00101 inline _OutputIterator
00102 partial_sum(_InputIterator __first, _InputIterator __last,
00103             _OutputIterator __result, _BinaryOperation __binary_op) {
00104   return _STLP_PRIV __partial_sum(__first, __last, __result, _STLP_VALUE_TYPE(__first, _InputIterator),
00105                                   __binary_op);
00106 }
00107 
00108 _STLP_MOVE_TO_PRIV_NAMESPACE
00109 
00110 template <class _InputIterator, class _OutputIterator, class _Tp,
00111           class _BinaryOperation>
00112 _OutputIterator
00113 __adjacent_difference(_InputIterator __first, _InputIterator __last,
00114                       _OutputIterator __result, _Tp*,
00115                       _BinaryOperation __binary_op);
00116 
00117 _STLP_MOVE_TO_STD_NAMESPACE
00118 
00119 template <class _InputIterator, class _OutputIterator>
00120 inline _OutputIterator
00121 adjacent_difference(_InputIterator __first,
00122                     _InputIterator __last, _OutputIterator __result) {
00123   return _STLP_PRIV __adjacent_difference(__first, __last, __result,
00124                                           _STLP_VALUE_TYPE(__first, _InputIterator),
00125                                           _STLP_PRIV __minus(_STLP_VALUE_TYPE(__first, _InputIterator)));
00126 }
00127 
00128 template <class _InputIterator, class _OutputIterator, class _BinaryOperation>
00129 _OutputIterator
00130 adjacent_difference(_InputIterator __first, _InputIterator __last,
00131                     _OutputIterator __result, _BinaryOperation __binary_op) {
00132   return _STLP_PRIV __adjacent_difference(__first, __last, __result,
00133                                           _STLP_VALUE_TYPE(__first, _InputIterator),
00134                                           __binary_op);
00135 }
00136 
00137 _STLP_MOVE_TO_PRIV_NAMESPACE
00138 
00139 template <class _Tp, class _Integer, class _MonoidOperation>
00140 _Tp __power(_Tp __x, _Integer __n, _MonoidOperation __opr);
00141 
00142 _STLP_MOVE_TO_STD_NAMESPACE
00143 
00144 #if !defined (_STLP_NO_EXTENSIONS)
00145 
00146 // Returns __x ** __n, where __n >= 0.  _Note that "multiplication"
00147 // is required to be associative, but not necessarily commutative.
00148 
00149 _STLP_MOVE_TO_PRIV_NAMESPACE
00150 
00151 template <class _Tp, class _Integer>
00152 inline _Tp __power(_Tp __x, _Integer __n) {
00153   return __power(__x, __n, multiplies<_Tp>());
00154 }
00155 
00156 _STLP_MOVE_TO_STD_NAMESPACE
00157 
00158 // Alias for the internal name __power.  Note that power is an extension,
00159 // not part of the C++ standard.
00160 template <class _Tp, class _Integer, class _MonoidOperation>
00161 inline _Tp power(_Tp __x, _Integer __n, _MonoidOperation __opr) {
00162   return _STLP_PRIV __power(__x, __n, __opr);
00163 }
00164 
00165 template <class _Tp, class _Integer>
00166 inline _Tp power(_Tp __x, _Integer __n) {
00167   return _STLP_PRIV __power(__x, __n, multiplies<_Tp>());
00168 }
00169 
00170 // iota is not part of the C++ standard.  It is an extension.
00171 
00172 template <class _ForwardIterator, class _Tp>
00173 _STLP_INLINE_LOOP
00174 void iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __val) {
00175   _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
00176   while (__first != __last)
00177     *__first++ = __val++;
00178 }
00179 #endif
00180 
00181 _STLP_END_NAMESPACE
00182 
00183 #if !defined (_STLP_LINK_TIME_INSTANTIATION)
00184 #  include <stl/_numeric.c>
00185 #endif
00186 
00187 #endif /* _STLP_INTERNAL_NUMERIC_H */
00188 
00189 // Local Variables:
00190 // mode:C++
00191 // End:

Generated on Mon May 28 2012 04:29:12 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.