1.1 --- a/epoc32/include/stdapis/stlportv5/stl/_numeric.h Wed Mar 31 12:27:01 2010 +0100
1.2 +++ b/epoc32/include/stdapis/stlportv5/stl/_numeric.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -6,13 +6,13 @@
1.4 * Copyright (c) 1996,1997
1.5 * Silicon Graphics Computer Systems, Inc.
1.6 *
1.7 - * Copyright (c) 1999
1.8 + * Copyright (c) 1999
1.9 * Boris Fomitchev
1.10 *
1.11 * This material is provided "as is", with absolutely no warranty expressed
1.12 * or implied. Any use is at your own risk.
1.13 *
1.14 - * Permission to use or copy this software for any purpose is hereby granted
1.15 + * Permission to use or copy this software for any purpose is hereby granted
1.16 * without fee, provided the above notices are retained on all copies.
1.17 * Permission to modify the code and to distribute modified code is granted,
1.18 * provided the above notices are retained, and a notice that the code was
1.19 @@ -24,40 +24,33 @@
1.20 * You should not attempt to use it directly.
1.21 */
1.22
1.23 -
1.24 #ifndef _STLP_INTERNAL_NUMERIC_H
1.25 #define _STLP_INTERNAL_NUMERIC_H
1.26
1.27 -#ifndef _STLP_INTERNAL_FUNCTION_H
1.28 +#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
1.29 # include <stl/_function_base.h>
1.30 #endif
1.31
1.32 #ifndef _STLP_INTERNAL_ITERATOR_BASE_H
1.33 -# include <stl/_iterator_base.h>
1.34 +# include <stl/_iterator_base.h>
1.35 #endif
1.36
1.37 _STLP_BEGIN_NAMESPACE
1.38
1.39 template <class _InputIterator, class _Tp>
1.40 _STLP_INLINE_LOOP
1.41 -_Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp _Init)
1.42 -{
1.43 - _STLP_DEBUG_CHECK(__check_range(__first, __last))
1.44 +_Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp _Init) {
1.45 + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
1.46 for ( ; __first != __last; ++__first)
1.47 -#ifndef __SYMBIAN32__
1.48 _Init = _Init + *__first;
1.49 -#else
1.50 - _Init += *__first;
1.51 -#endif
1.52 return _Init;
1.53 }
1.54
1.55 template <class _InputIterator, class _Tp, class _BinaryOperation>
1.56 _STLP_INLINE_LOOP
1.57 _Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp _Init,
1.58 - _BinaryOperation __binary_op)
1.59 -{
1.60 - _STLP_DEBUG_CHECK(__check_range(__first, __last))
1.61 + _BinaryOperation __binary_op) {
1.62 + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
1.63 for ( ; __first != __last; ++__first)
1.64 _Init = __binary_op(_Init, *__first);
1.65 return _Init;
1.66 @@ -66,9 +59,8 @@
1.67 template <class _InputIterator1, class _InputIterator2, class _Tp>
1.68 _STLP_INLINE_LOOP
1.69 _Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1,
1.70 - _InputIterator2 __first2, _Tp _Init)
1.71 -{
1.72 - _STLP_DEBUG_CHECK(__check_range(__first1, __last1))
1.73 + _InputIterator2 __first2, _Tp _Init) {
1.74 + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
1.75 for ( ; __first1 != __last1; ++__first1, ++__first2)
1.76 _Init = _Init + (*__first1 * *__first2);
1.77 return _Init;
1.78 @@ -78,110 +70,119 @@
1.79 class _BinaryOperation1, class _BinaryOperation2>
1.80 _STLP_INLINE_LOOP
1.81 _Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1,
1.82 - _InputIterator2 __first2, _Tp _Init,
1.83 + _InputIterator2 __first2, _Tp _Init,
1.84 _BinaryOperation1 __binary_op1,
1.85 - _BinaryOperation2 __binary_op2)
1.86 -{
1.87 - _STLP_DEBUG_CHECK(__check_range(__first1, __last1))
1.88 + _BinaryOperation2 __binary_op2) {
1.89 + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
1.90 for ( ; __first1 != __last1; ++__first1, ++__first2)
1.91 _Init = __binary_op1(_Init, __binary_op2(*__first1, *__first2));
1.92 return _Init;
1.93 }
1.94
1.95 +_STLP_MOVE_TO_PRIV_NAMESPACE
1.96 +
1.97 template <class _InputIterator, class _OutputIterator, class _Tp,
1.98 class _BinaryOperation>
1.99 -_OutputIterator
1.100 -__partial_sum(_InputIterator __first, _InputIterator __last,
1.101 +_OutputIterator
1.102 +__partial_sum(_InputIterator __first, _InputIterator __last,
1.103 _OutputIterator __result, _Tp*, _BinaryOperation __binary_op);
1.104
1.105 +_STLP_MOVE_TO_STD_NAMESPACE
1.106
1.107 template <class _InputIterator, class _OutputIterator>
1.108 -inline _OutputIterator
1.109 +inline _OutputIterator
1.110 partial_sum(_InputIterator __first, _InputIterator __last,
1.111 _OutputIterator __result) {
1.112 - return __partial_sum(__first, __last, __result, _STLP_VALUE_TYPE(__first, _InputIterator),
1.113 - __plus(_STLP_VALUE_TYPE(__first, _InputIterator)));
1.114 + return _STLP_PRIV __partial_sum(__first, __last, __result, _STLP_VALUE_TYPE(__first, _InputIterator),
1.115 + _STLP_PRIV __plus(_STLP_VALUE_TYPE(__first, _InputIterator)));
1.116 }
1.117
1.118 template <class _InputIterator, class _OutputIterator, class _BinaryOperation>
1.119 -inline _OutputIterator
1.120 +inline _OutputIterator
1.121 partial_sum(_InputIterator __first, _InputIterator __last,
1.122 _OutputIterator __result, _BinaryOperation __binary_op) {
1.123 - return __partial_sum(__first, __last, __result, _STLP_VALUE_TYPE(__first, _InputIterator),
1.124 - __binary_op);
1.125 + return _STLP_PRIV __partial_sum(__first, __last, __result, _STLP_VALUE_TYPE(__first, _InputIterator),
1.126 + __binary_op);
1.127 }
1.128
1.129 +_STLP_MOVE_TO_PRIV_NAMESPACE
1.130
1.131 -template <class _InputIterator, class _OutputIterator, class _Tp,
1.132 +template <class _InputIterator, class _OutputIterator, class _Tp,
1.133 class _BinaryOperation>
1.134 _OutputIterator
1.135 -__adjacent_difference(_InputIterator __first, _InputIterator __last,
1.136 +__adjacent_difference(_InputIterator __first, _InputIterator __last,
1.137 _OutputIterator __result, _Tp*,
1.138 _BinaryOperation __binary_op);
1.139
1.140 +_STLP_MOVE_TO_STD_NAMESPACE
1.141 +
1.142 template <class _InputIterator, class _OutputIterator>
1.143 inline _OutputIterator
1.144 adjacent_difference(_InputIterator __first,
1.145 _InputIterator __last, _OutputIterator __result) {
1.146 - return __adjacent_difference(__first, __last, __result,
1.147 - _STLP_VALUE_TYPE(__first, _InputIterator),
1.148 - __minus(_STLP_VALUE_TYPE(__first, _InputIterator)));
1.149 + return _STLP_PRIV __adjacent_difference(__first, __last, __result,
1.150 + _STLP_VALUE_TYPE(__first, _InputIterator),
1.151 + _STLP_PRIV __minus(_STLP_VALUE_TYPE(__first, _InputIterator)));
1.152 }
1.153
1.154 template <class _InputIterator, class _OutputIterator, class _BinaryOperation>
1.155 -_OutputIterator
1.156 +_OutputIterator
1.157 adjacent_difference(_InputIterator __first, _InputIterator __last,
1.158 _OutputIterator __result, _BinaryOperation __binary_op) {
1.159 - return __adjacent_difference(__first, __last, __result,
1.160 - _STLP_VALUE_TYPE(__first, _InputIterator),
1.161 - __binary_op);
1.162 + return _STLP_PRIV __adjacent_difference(__first, __last, __result,
1.163 + _STLP_VALUE_TYPE(__first, _InputIterator),
1.164 + __binary_op);
1.165 }
1.166
1.167 +_STLP_MOVE_TO_PRIV_NAMESPACE
1.168 +
1.169 template <class _Tp, class _Integer, class _MonoidOperation>
1.170 _Tp __power(_Tp __x, _Integer __n, _MonoidOperation __opr);
1.171
1.172 -# ifndef _STLP_NO_EXTENSIONS
1.173 +_STLP_MOVE_TO_STD_NAMESPACE
1.174 +
1.175 +#if !defined (_STLP_NO_EXTENSIONS)
1.176
1.177 // Returns __x ** __n, where __n >= 0. _Note that "multiplication"
1.178 // is required to be associative, but not necessarily commutative.
1.179
1.180 +_STLP_MOVE_TO_PRIV_NAMESPACE
1.181 +
1.182 template <class _Tp, class _Integer>
1.183 -inline _Tp __power(_Tp __x, _Integer __n)
1.184 -{
1.185 +inline _Tp __power(_Tp __x, _Integer __n) {
1.186 return __power(__x, __n, multiplies<_Tp>());
1.187 }
1.188
1.189 +_STLP_MOVE_TO_STD_NAMESPACE
1.190 +
1.191 // Alias for the internal name __power. Note that power is an extension,
1.192 // not part of the C++ standard.
1.193 template <class _Tp, class _Integer, class _MonoidOperation>
1.194 inline _Tp power(_Tp __x, _Integer __n, _MonoidOperation __opr) {
1.195 - return __power(__x, __n, __opr);
1.196 + return _STLP_PRIV __power(__x, __n, __opr);
1.197 }
1.198
1.199 -
1.200 template <class _Tp, class _Integer>
1.201 inline _Tp power(_Tp __x, _Integer __n) {
1.202 - return __power(__x, __n, multiplies<_Tp>());
1.203 + return _STLP_PRIV __power(__x, __n, multiplies<_Tp>());
1.204 }
1.205
1.206 // iota is not part of the C++ standard. It is an extension.
1.207
1.208 template <class _ForwardIterator, class _Tp>
1.209 _STLP_INLINE_LOOP
1.210 -void
1.211 -iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __val)
1.212 -{
1.213 - _STLP_DEBUG_CHECK(__check_range(__first, __last))
1.214 +void iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __val) {
1.215 + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
1.216 while (__first != __last)
1.217 *__first++ = __val++;
1.218 }
1.219 -# endif
1.220 +#endif
1.221
1.222 _STLP_END_NAMESPACE
1.223
1.224 -# if !defined (_STLP_LINK_TIME_INSTANTIATION)
1.225 +#if !defined (_STLP_LINK_TIME_INSTANTIATION)
1.226 # include <stl/_numeric.c>
1.227 -# endif
1.228 +#endif
1.229
1.230 #endif /* _STLP_INTERNAL_NUMERIC_H */
1.231