stl_algo.h name conflict with gcc internal

Petter Urkedal petter@matfys.lth.se
Sun Oct 31 23:03:00 GMT 1999


> Ok, I see what you're up against now. Can you go ahead and send a me a
> patch for all __op* names based on v-3, and I'll retrofit it into egcs? 

This is what I found with grep __opr `find . -type f`.
[Benjamin: Sorry, I forgot te edit the To/CC fields.]

 -petter.


1999-10-22  Petter Urkedal  <petter@matfys.lth.se>

        * stl/bits/stl_numeric.h (__power): Replaced argument name
`__opr'
        to avoid conflict with gcc name mangling.
        * stl/bits/stl_algo.h (__transform): Same.



Index: stl_algo.h
===================================================================
RCS file: /cvs/libstdc++/libstdc++/stl/bits/stl_algo.h,v
retrieving revision 1.8
diff -c -r1.8 stl_algo.h
*** stl_algo.h  1999/04/06 17:44:02     1.8
--- stl_algo.h  1999/10/22 09:56:17
***************
*** 449,457 ****
  
  template <class _InputIter, class _OutputIter, class _UnaryOperation>
  _OutputIter transform(_InputIter __first, _InputIter __last,
!                       _OutputIter __result, _UnaryOperation __opr) {
    for ( ; __first != __last; ++__first, ++__result)
!     *__result = __opr(*__first);
    return __result;
  }
  
--- 449,457 ----
  
  template <class _InputIter, class _OutputIter, class _UnaryOperation>
  _OutputIter transform(_InputIter __first, _InputIter __last,
!                       _OutputIter __result, _UnaryOperation
__unary_op) {
    for ( ; __first != __last; ++__first, ++__result)
!     *__result = __unary_op(*__first);
    return __result;
  }
  


Index: stl_numeric.h
===================================================================
RCS file: /cvs/libstdc++/libstdc++/stl/bits/stl_numeric.h,v
retrieving revision 1.3
diff -c -r1.3 stl_numeric.h
*** stl_numeric.h       1998/07/24 18:42:07     1.3
--- stl_numeric.h       1999/10/22 09:57:27
***************
*** 177,198 ****
  
   
  template <class _Tp, class _Integer, class _MonoidOperation>
! _Tp __power(_Tp __x, _Integer __n, _MonoidOperation __opr)
  {
    if (__n == 0)
!     return identity_element(__opr);
    else {
      while ((__n & 1) == 0) {
        __n >>= 1;
!       __x = __opr(__x, __x);
      }
  
      _Tp __result = __x;
      __n >>= 1;
      while (__n != 0) {
!       __x = __opr(__x, __x);
        if ((__n & 1) != 0)
!         __result = __opr(__result, __x);
        __n >>= 1;
      }
      return __result;
--- 177,198 ----
  
   
  template <class _Tp, class _Integer, class _MonoidOperation>
! _Tp __power(_Tp __x, _Integer __n, _MonoidOperation __monoid_op)
  {
    if (__n == 0)
!     return identity_element(__monoid_op);
    else {
      while ((__n & 1) == 0) {
        __n >>= 1;
!       __x = __monoid_op(__x, __x);
      }
  
      _Tp __result = __x;
      __n >>= 1;
      while (__n != 0) {
!       __x = __monoid_op(__x, __x);
        if ((__n & 1) != 0)
!         __result = __monoid_op(__result, __x);
        __n >>= 1;
      }
      return __result;
***************
*** 209,217 ****
  // not part of the C++ standard.
  
  template <class _Tp, class _Integer, class _MonoidOperation>
! inline _Tp power(_Tp __x, _Integer __n, _MonoidOperation __opr)
  {
!   return __power(__x, __n, __opr);
  }
  
  template <class _Tp, class _Integer>
--- 209,217 ----
  // not part of the C++ standard.
  
  template <class _Tp, class _Integer, class _MonoidOperation>
! inline _Tp power(_Tp __x, _Integer __n, _MonoidOperation __monoid_op)
  {
!   return __power(__x, __n, __monoid_op);
  }
  
  template <class _Tp, class _Integer>



More information about the Gcc-bugs mailing list