1*e4b17023SJohn Marino // Numeric functions implementation -*- C++ -*- 2*e4b17023SJohn Marino 3*e4b17023SJohn Marino // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 4*e4b17023SJohn Marino // 2011 Free Software Foundation, Inc. 5*e4b17023SJohn Marino // 6*e4b17023SJohn Marino // This file is part of the GNU ISO C++ Library. This library is free 7*e4b17023SJohn Marino // software; you can redistribute it and/or modify it under the 8*e4b17023SJohn Marino // terms of the GNU General Public License as published by the 9*e4b17023SJohn Marino // Free Software Foundation; either version 3, or (at your option) 10*e4b17023SJohn Marino // any later version. 11*e4b17023SJohn Marino 12*e4b17023SJohn Marino // This library is distributed in the hope that it will be useful, 13*e4b17023SJohn Marino // but WITHOUT ANY WARRANTY; without even the implied warranty of 14*e4b17023SJohn Marino // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15*e4b17023SJohn Marino // GNU General Public License for more details. 16*e4b17023SJohn Marino 17*e4b17023SJohn Marino // Under Section 7 of GPL version 3, you are granted additional 18*e4b17023SJohn Marino // permissions described in the GCC Runtime Library Exception, version 19*e4b17023SJohn Marino // 3.1, as published by the Free Software Foundation. 20*e4b17023SJohn Marino 21*e4b17023SJohn Marino // You should have received a copy of the GNU General Public License and 22*e4b17023SJohn Marino // a copy of the GCC Runtime Library Exception along with this program; 23*e4b17023SJohn Marino // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 24*e4b17023SJohn Marino // <http://www.gnu.org/licenses/>. 25*e4b17023SJohn Marino 26*e4b17023SJohn Marino /* 27*e4b17023SJohn Marino * 28*e4b17023SJohn Marino * Copyright (c) 1994 29*e4b17023SJohn Marino * Hewlett-Packard Company 30*e4b17023SJohn Marino * 31*e4b17023SJohn Marino * Permission to use, copy, modify, distribute and sell this software 32*e4b17023SJohn Marino * and its documentation for any purpose is hereby granted without fee, 33*e4b17023SJohn Marino * provided that the above copyright notice appear in all copies and 34*e4b17023SJohn Marino * that both that copyright notice and this permission notice appear 35*e4b17023SJohn Marino * in supporting documentation. Hewlett-Packard Company makes no 36*e4b17023SJohn Marino * representations about the suitability of this software for any 37*e4b17023SJohn Marino * purpose. It is provided "as is" without express or implied warranty. 38*e4b17023SJohn Marino * 39*e4b17023SJohn Marino * 40*e4b17023SJohn Marino * Copyright (c) 1996,1997 41*e4b17023SJohn Marino * Silicon Graphics Computer Systems, Inc. 42*e4b17023SJohn Marino * 43*e4b17023SJohn Marino * Permission to use, copy, modify, distribute and sell this software 44*e4b17023SJohn Marino * and its documentation for any purpose is hereby granted without fee, 45*e4b17023SJohn Marino * provided that the above copyright notice appear in all copies and 46*e4b17023SJohn Marino * that both that copyright notice and this permission notice appear 47*e4b17023SJohn Marino * in supporting documentation. Silicon Graphics makes no 48*e4b17023SJohn Marino * representations about the suitability of this software for any 49*e4b17023SJohn Marino * purpose. It is provided "as is" without express or implied warranty. 50*e4b17023SJohn Marino */ 51*e4b17023SJohn Marino 52*e4b17023SJohn Marino /** @file bits/stl_numeric.h 53*e4b17023SJohn Marino * This is an internal header file, included by other library headers. 54*e4b17023SJohn Marino * Do not attempt to use it directly. @headername{numeric} 55*e4b17023SJohn Marino */ 56*e4b17023SJohn Marino 57*e4b17023SJohn Marino #ifndef _STL_NUMERIC_H 58*e4b17023SJohn Marino #define _STL_NUMERIC_H 1 59*e4b17023SJohn Marino 60*e4b17023SJohn Marino #include <bits/concept_check.h> 61*e4b17023SJohn Marino #include <debug/debug.h> 62*e4b17023SJohn Marino #include <bits/move.h> // For _GLIBCXX_MOVE 63*e4b17023SJohn Marino 64*e4b17023SJohn Marino #ifdef __GXX_EXPERIMENTAL_CXX0X__ 65*e4b17023SJohn Marino 66*e4b17023SJohn Marino namespace std _GLIBCXX_VISIBILITY(default) 67*e4b17023SJohn Marino { 68*e4b17023SJohn Marino _GLIBCXX_BEGIN_NAMESPACE_VERSION 69*e4b17023SJohn Marino 70*e4b17023SJohn Marino /** 71*e4b17023SJohn Marino * @brief Create a range of sequentially increasing values. 72*e4b17023SJohn Marino * 73*e4b17023SJohn Marino * For each element in the range @p [first,last) assigns @p value and 74*e4b17023SJohn Marino * increments @p value as if by @p ++value. 75*e4b17023SJohn Marino * 76*e4b17023SJohn Marino * @param __first Start of range. 77*e4b17023SJohn Marino * @param __last End of range. 78*e4b17023SJohn Marino * @param __value Starting value. 79*e4b17023SJohn Marino * @return Nothing. 80*e4b17023SJohn Marino */ 81*e4b17023SJohn Marino template<typename _ForwardIterator, typename _Tp> 82*e4b17023SJohn Marino void 83*e4b17023SJohn Marino iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value) 84*e4b17023SJohn Marino { 85*e4b17023SJohn Marino // concept requirements 86*e4b17023SJohn Marino __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< 87*e4b17023SJohn Marino _ForwardIterator>) 88*e4b17023SJohn Marino __glibcxx_function_requires(_ConvertibleConcept<_Tp, 89*e4b17023SJohn Marino typename iterator_traits<_ForwardIterator>::value_type>) 90*e4b17023SJohn Marino __glibcxx_requires_valid_range(__first, __last); 91*e4b17023SJohn Marino 92*e4b17023SJohn Marino for (; __first != __last; ++__first) 93*e4b17023SJohn Marino { 94*e4b17023SJohn Marino *__first = __value; 95*e4b17023SJohn Marino ++__value; 96*e4b17023SJohn Marino } 97*e4b17023SJohn Marino } 98*e4b17023SJohn Marino 99*e4b17023SJohn Marino _GLIBCXX_END_NAMESPACE_VERSION 100*e4b17023SJohn Marino } // namespace std 101*e4b17023SJohn Marino 102*e4b17023SJohn Marino #endif 103*e4b17023SJohn Marino 104*e4b17023SJohn Marino namespace std _GLIBCXX_VISIBILITY(default) 105*e4b17023SJohn Marino { 106*e4b17023SJohn Marino _GLIBCXX_BEGIN_NAMESPACE_ALGO 107*e4b17023SJohn Marino 108*e4b17023SJohn Marino /** 109*e4b17023SJohn Marino * @brief Accumulate values in a range. 110*e4b17023SJohn Marino * 111*e4b17023SJohn Marino * Accumulates the values in the range [first,last) using operator+(). The 112*e4b17023SJohn Marino * initial value is @a init. The values are processed in order. 113*e4b17023SJohn Marino * 114*e4b17023SJohn Marino * @param __first Start of range. 115*e4b17023SJohn Marino * @param __last End of range. 116*e4b17023SJohn Marino * @param __init Starting value to add other values to. 117*e4b17023SJohn Marino * @return The final sum. 118*e4b17023SJohn Marino */ 119*e4b17023SJohn Marino template<typename _InputIterator, typename _Tp> 120*e4b17023SJohn Marino inline _Tp 121*e4b17023SJohn Marino accumulate(_InputIterator __first, _InputIterator __last, _Tp __init) 122*e4b17023SJohn Marino { 123*e4b17023SJohn Marino // concept requirements 124*e4b17023SJohn Marino __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) 125*e4b17023SJohn Marino __glibcxx_requires_valid_range(__first, __last); 126*e4b17023SJohn Marino 127*e4b17023SJohn Marino for (; __first != __last; ++__first) 128*e4b17023SJohn Marino __init = __init + *__first; 129*e4b17023SJohn Marino return __init; 130*e4b17023SJohn Marino } 131*e4b17023SJohn Marino 132*e4b17023SJohn Marino /** 133*e4b17023SJohn Marino * @brief Accumulate values in a range with operation. 134*e4b17023SJohn Marino * 135*e4b17023SJohn Marino * Accumulates the values in the range [first,last) using the function 136*e4b17023SJohn Marino * object @p __binary_op. The initial value is @p __init. The values are 137*e4b17023SJohn Marino * processed in order. 138*e4b17023SJohn Marino * 139*e4b17023SJohn Marino * @param __first Start of range. 140*e4b17023SJohn Marino * @param __last End of range. 141*e4b17023SJohn Marino * @param __init Starting value to add other values to. 142*e4b17023SJohn Marino * @param __binary_op Function object to accumulate with. 143*e4b17023SJohn Marino * @return The final sum. 144*e4b17023SJohn Marino */ 145*e4b17023SJohn Marino template<typename _InputIterator, typename _Tp, typename _BinaryOperation> 146*e4b17023SJohn Marino inline _Tp 147*e4b17023SJohn Marino accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, 148*e4b17023SJohn Marino _BinaryOperation __binary_op) 149*e4b17023SJohn Marino { 150*e4b17023SJohn Marino // concept requirements 151*e4b17023SJohn Marino __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) 152*e4b17023SJohn Marino __glibcxx_requires_valid_range(__first, __last); 153*e4b17023SJohn Marino 154*e4b17023SJohn Marino for (; __first != __last; ++__first) 155*e4b17023SJohn Marino __init = __binary_op(__init, *__first); 156*e4b17023SJohn Marino return __init; 157*e4b17023SJohn Marino } 158*e4b17023SJohn Marino 159*e4b17023SJohn Marino /** 160*e4b17023SJohn Marino * @brief Compute inner product of two ranges. 161*e4b17023SJohn Marino * 162*e4b17023SJohn Marino * Starting with an initial value of @p __init, multiplies successive 163*e4b17023SJohn Marino * elements from the two ranges and adds each product into the accumulated 164*e4b17023SJohn Marino * value using operator+(). The values in the ranges are processed in 165*e4b17023SJohn Marino * order. 166*e4b17023SJohn Marino * 167*e4b17023SJohn Marino * @param __first1 Start of range 1. 168*e4b17023SJohn Marino * @param __last1 End of range 1. 169*e4b17023SJohn Marino * @param __first2 Start of range 2. 170*e4b17023SJohn Marino * @param __init Starting value to add other values to. 171*e4b17023SJohn Marino * @return The final inner product. 172*e4b17023SJohn Marino */ 173*e4b17023SJohn Marino template<typename _InputIterator1, typename _InputIterator2, typename _Tp> 174*e4b17023SJohn Marino inline _Tp 175*e4b17023SJohn Marino inner_product(_InputIterator1 __first1, _InputIterator1 __last1, 176*e4b17023SJohn Marino _InputIterator2 __first2, _Tp __init) 177*e4b17023SJohn Marino { 178*e4b17023SJohn Marino // concept requirements 179*e4b17023SJohn Marino __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) 180*e4b17023SJohn Marino __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) 181*e4b17023SJohn Marino __glibcxx_requires_valid_range(__first1, __last1); 182*e4b17023SJohn Marino 183*e4b17023SJohn Marino for (; __first1 != __last1; ++__first1, ++__first2) 184*e4b17023SJohn Marino __init = __init + (*__first1 * *__first2); 185*e4b17023SJohn Marino return __init; 186*e4b17023SJohn Marino } 187*e4b17023SJohn Marino 188*e4b17023SJohn Marino /** 189*e4b17023SJohn Marino * @brief Compute inner product of two ranges. 190*e4b17023SJohn Marino * 191*e4b17023SJohn Marino * Starting with an initial value of @p __init, applies @p __binary_op2 to 192*e4b17023SJohn Marino * successive elements from the two ranges and accumulates each result into 193*e4b17023SJohn Marino * the accumulated value using @p __binary_op1. The values in the ranges are 194*e4b17023SJohn Marino * processed in order. 195*e4b17023SJohn Marino * 196*e4b17023SJohn Marino * @param __first1 Start of range 1. 197*e4b17023SJohn Marino * @param __last1 End of range 1. 198*e4b17023SJohn Marino * @param __first2 Start of range 2. 199*e4b17023SJohn Marino * @param __init Starting value to add other values to. 200*e4b17023SJohn Marino * @param __binary_op1 Function object to accumulate with. 201*e4b17023SJohn Marino * @param __binary_op2 Function object to apply to pairs of input values. 202*e4b17023SJohn Marino * @return The final inner product. 203*e4b17023SJohn Marino */ 204*e4b17023SJohn Marino template<typename _InputIterator1, typename _InputIterator2, typename _Tp, 205*e4b17023SJohn Marino typename _BinaryOperation1, typename _BinaryOperation2> 206*e4b17023SJohn Marino inline _Tp 207*e4b17023SJohn Marino inner_product(_InputIterator1 __first1, _InputIterator1 __last1, 208*e4b17023SJohn Marino _InputIterator2 __first2, _Tp __init, 209*e4b17023SJohn Marino _BinaryOperation1 __binary_op1, 210*e4b17023SJohn Marino _BinaryOperation2 __binary_op2) 211*e4b17023SJohn Marino { 212*e4b17023SJohn Marino // concept requirements 213*e4b17023SJohn Marino __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) 214*e4b17023SJohn Marino __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) 215*e4b17023SJohn Marino __glibcxx_requires_valid_range(__first1, __last1); 216*e4b17023SJohn Marino 217*e4b17023SJohn Marino for (; __first1 != __last1; ++__first1, ++__first2) 218*e4b17023SJohn Marino __init = __binary_op1(__init, __binary_op2(*__first1, *__first2)); 219*e4b17023SJohn Marino return __init; 220*e4b17023SJohn Marino } 221*e4b17023SJohn Marino 222*e4b17023SJohn Marino /** 223*e4b17023SJohn Marino * @brief Return list of partial sums 224*e4b17023SJohn Marino * 225*e4b17023SJohn Marino * Accumulates the values in the range [first,last) using the @c + operator. 226*e4b17023SJohn Marino * As each successive input value is added into the total, that partial sum 227*e4b17023SJohn Marino * is written to @p __result. Therefore, the first value in @p __result is 228*e4b17023SJohn Marino * the first value of the input, the second value in @p __result is the sum 229*e4b17023SJohn Marino * of the first and second input values, and so on. 230*e4b17023SJohn Marino * 231*e4b17023SJohn Marino * @param __first Start of input range. 232*e4b17023SJohn Marino * @param __last End of input range. 233*e4b17023SJohn Marino * @param __result Output sum. 234*e4b17023SJohn Marino * @return Iterator pointing just beyond the values written to __result. 235*e4b17023SJohn Marino */ 236*e4b17023SJohn Marino template<typename _InputIterator, typename _OutputIterator> 237*e4b17023SJohn Marino _OutputIterator 238*e4b17023SJohn Marino partial_sum(_InputIterator __first, _InputIterator __last, 239*e4b17023SJohn Marino _OutputIterator __result) 240*e4b17023SJohn Marino { 241*e4b17023SJohn Marino typedef typename iterator_traits<_InputIterator>::value_type _ValueType; 242*e4b17023SJohn Marino 243*e4b17023SJohn Marino // concept requirements 244*e4b17023SJohn Marino __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) 245*e4b17023SJohn Marino __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, 246*e4b17023SJohn Marino _ValueType>) 247*e4b17023SJohn Marino __glibcxx_requires_valid_range(__first, __last); 248*e4b17023SJohn Marino 249*e4b17023SJohn Marino if (__first == __last) 250*e4b17023SJohn Marino return __result; 251*e4b17023SJohn Marino _ValueType __value = *__first; 252*e4b17023SJohn Marino *__result = __value; 253*e4b17023SJohn Marino while (++__first != __last) 254*e4b17023SJohn Marino { 255*e4b17023SJohn Marino __value = __value + *__first; 256*e4b17023SJohn Marino *++__result = __value; 257*e4b17023SJohn Marino } 258*e4b17023SJohn Marino return ++__result; 259*e4b17023SJohn Marino } 260*e4b17023SJohn Marino 261*e4b17023SJohn Marino /** 262*e4b17023SJohn Marino * @brief Return list of partial sums 263*e4b17023SJohn Marino * 264*e4b17023SJohn Marino * Accumulates the values in the range [first,last) using @p __binary_op. 265*e4b17023SJohn Marino * As each successive input value is added into the total, that partial sum 266*e4b17023SJohn Marino * is written to @p __result. Therefore, the first value in @p __result is 267*e4b17023SJohn Marino * the first value of the input, the second value in @p __result is the sum 268*e4b17023SJohn Marino * of the first and second input values, and so on. 269*e4b17023SJohn Marino * 270*e4b17023SJohn Marino * @param __first Start of input range. 271*e4b17023SJohn Marino * @param __last End of input range. 272*e4b17023SJohn Marino * @param __result Output sum. 273*e4b17023SJohn Marino * @param __binary_op Function object. 274*e4b17023SJohn Marino * @return Iterator pointing just beyond the values written to __result. 275*e4b17023SJohn Marino */ 276*e4b17023SJohn Marino template<typename _InputIterator, typename _OutputIterator, 277*e4b17023SJohn Marino typename _BinaryOperation> 278*e4b17023SJohn Marino _OutputIterator 279*e4b17023SJohn Marino partial_sum(_InputIterator __first, _InputIterator __last, 280*e4b17023SJohn Marino _OutputIterator __result, _BinaryOperation __binary_op) 281*e4b17023SJohn Marino { 282*e4b17023SJohn Marino typedef typename iterator_traits<_InputIterator>::value_type _ValueType; 283*e4b17023SJohn Marino 284*e4b17023SJohn Marino // concept requirements 285*e4b17023SJohn Marino __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) 286*e4b17023SJohn Marino __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, 287*e4b17023SJohn Marino _ValueType>) 288*e4b17023SJohn Marino __glibcxx_requires_valid_range(__first, __last); 289*e4b17023SJohn Marino 290*e4b17023SJohn Marino if (__first == __last) 291*e4b17023SJohn Marino return __result; 292*e4b17023SJohn Marino _ValueType __value = *__first; 293*e4b17023SJohn Marino *__result = __value; 294*e4b17023SJohn Marino while (++__first != __last) 295*e4b17023SJohn Marino { 296*e4b17023SJohn Marino __value = __binary_op(__value, *__first); 297*e4b17023SJohn Marino *++__result = __value; 298*e4b17023SJohn Marino } 299*e4b17023SJohn Marino return ++__result; 300*e4b17023SJohn Marino } 301*e4b17023SJohn Marino 302*e4b17023SJohn Marino /** 303*e4b17023SJohn Marino * @brief Return differences between adjacent values. 304*e4b17023SJohn Marino * 305*e4b17023SJohn Marino * Computes the difference between adjacent values in the range 306*e4b17023SJohn Marino * [first,last) using operator-() and writes the result to @p __result. 307*e4b17023SJohn Marino * 308*e4b17023SJohn Marino * @param __first Start of input range. 309*e4b17023SJohn Marino * @param __last End of input range. 310*e4b17023SJohn Marino * @param __result Output sums. 311*e4b17023SJohn Marino * @return Iterator pointing just beyond the values written to result. 312*e4b17023SJohn Marino * 313*e4b17023SJohn Marino * _GLIBCXX_RESOLVE_LIB_DEFECTS 314*e4b17023SJohn Marino * DR 539. partial_sum and adjacent_difference should mention requirements 315*e4b17023SJohn Marino */ 316*e4b17023SJohn Marino template<typename _InputIterator, typename _OutputIterator> 317*e4b17023SJohn Marino _OutputIterator 318*e4b17023SJohn Marino adjacent_difference(_InputIterator __first, 319*e4b17023SJohn Marino _InputIterator __last, _OutputIterator __result) 320*e4b17023SJohn Marino { 321*e4b17023SJohn Marino typedef typename iterator_traits<_InputIterator>::value_type _ValueType; 322*e4b17023SJohn Marino 323*e4b17023SJohn Marino // concept requirements 324*e4b17023SJohn Marino __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) 325*e4b17023SJohn Marino __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, 326*e4b17023SJohn Marino _ValueType>) 327*e4b17023SJohn Marino __glibcxx_requires_valid_range(__first, __last); 328*e4b17023SJohn Marino 329*e4b17023SJohn Marino if (__first == __last) 330*e4b17023SJohn Marino return __result; 331*e4b17023SJohn Marino _ValueType __value = *__first; 332*e4b17023SJohn Marino *__result = __value; 333*e4b17023SJohn Marino while (++__first != __last) 334*e4b17023SJohn Marino { 335*e4b17023SJohn Marino _ValueType __tmp = *__first; 336*e4b17023SJohn Marino *++__result = __tmp - __value; 337*e4b17023SJohn Marino __value = _GLIBCXX_MOVE(__tmp); 338*e4b17023SJohn Marino } 339*e4b17023SJohn Marino return ++__result; 340*e4b17023SJohn Marino } 341*e4b17023SJohn Marino 342*e4b17023SJohn Marino /** 343*e4b17023SJohn Marino * @brief Return differences between adjacent values. 344*e4b17023SJohn Marino * 345*e4b17023SJohn Marino * Computes the difference between adjacent values in the range 346*e4b17023SJohn Marino * [__first,__last) using the function object @p __binary_op and writes the 347*e4b17023SJohn Marino * result to @p __result. 348*e4b17023SJohn Marino * 349*e4b17023SJohn Marino * @param __first Start of input range. 350*e4b17023SJohn Marino * @param __last End of input range. 351*e4b17023SJohn Marino * @param __result Output sum. 352*e4b17023SJohn Marino * @param __binary_op Function object. 353*e4b17023SJohn Marino * @return Iterator pointing just beyond the values written to result. 354*e4b17023SJohn Marino * 355*e4b17023SJohn Marino * _GLIBCXX_RESOLVE_LIB_DEFECTS 356*e4b17023SJohn Marino * DR 539. partial_sum and adjacent_difference should mention requirements 357*e4b17023SJohn Marino */ 358*e4b17023SJohn Marino template<typename _InputIterator, typename _OutputIterator, 359*e4b17023SJohn Marino typename _BinaryOperation> 360*e4b17023SJohn Marino _OutputIterator 361*e4b17023SJohn Marino adjacent_difference(_InputIterator __first, _InputIterator __last, 362*e4b17023SJohn Marino _OutputIterator __result, _BinaryOperation __binary_op) 363*e4b17023SJohn Marino { 364*e4b17023SJohn Marino typedef typename iterator_traits<_InputIterator>::value_type _ValueType; 365*e4b17023SJohn Marino 366*e4b17023SJohn Marino // concept requirements 367*e4b17023SJohn Marino __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) 368*e4b17023SJohn Marino __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, 369*e4b17023SJohn Marino _ValueType>) 370*e4b17023SJohn Marino __glibcxx_requires_valid_range(__first, __last); 371*e4b17023SJohn Marino 372*e4b17023SJohn Marino if (__first == __last) 373*e4b17023SJohn Marino return __result; 374*e4b17023SJohn Marino _ValueType __value = *__first; 375*e4b17023SJohn Marino *__result = __value; 376*e4b17023SJohn Marino while (++__first != __last) 377*e4b17023SJohn Marino { 378*e4b17023SJohn Marino _ValueType __tmp = *__first; 379*e4b17023SJohn Marino *++__result = __binary_op(__tmp, __value); 380*e4b17023SJohn Marino __value = _GLIBCXX_MOVE(__tmp); 381*e4b17023SJohn Marino } 382*e4b17023SJohn Marino return ++__result; 383*e4b17023SJohn Marino } 384*e4b17023SJohn Marino 385*e4b17023SJohn Marino _GLIBCXX_END_NAMESPACE_ALGO 386*e4b17023SJohn Marino } // namespace std 387*e4b17023SJohn Marino 388*e4b17023SJohn Marino #endif /* _STL_NUMERIC_H */ 389