c++/2138: trouble with STL's distance function

Wolfgang Bangerth wolfgang.bangerth@iwr.uni-heidelberg.de
Sun Apr 1 00:00:00 GMT 2001


The following reply was made to PR c++/2138; it has been noted by GNATS.

From: Wolfgang Bangerth <wolfgang.bangerth@iwr.uni-heidelberg.de>
To: gcc-bugs@gcc.gnu.org, gcc-patches@gcc.gnu.org, gcc-gnats@gcc.gnu.org,
   reichelt@igpm.rwth-aachen.de
Cc:  
Subject: Re: c++/2138: trouble with STL's distance function
Date: Thu, 1 Mar 2001 14:57:08 +0100 (MET)

 Hi there,
 based on the analysis of Volker, I guess that indeed the concepts checks
 are wrong: the standard requires that forward operators only have an index
 operator with semantics
   a[n]   <->   *(a+n)
 I cannot see that it must actually be assignable. (This is all [24.1.5].)
 
 If that were so, then the appended patch would be correct, and it indeed
 fixes his bug. (Unfortunately, it still doesn't fix c++/1657, which I
 hoped it would, but that seems more like a memory corruption bug. sigh :])
 
 Regards
   Wolfgang
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth          email: wolfgang.bangerth@iwr.uni-heidelberg.de
                              www: http://gaia.iwr.uni-heidelberg.de/~wolf
 
 Index: concept_checks.h
 ===================================================================
 RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/concept_checks.h,v
 retrieving revision 1.1
 diff -c -r1.1 concept_checks.h
 *** concept_checks.h	2000/10/05 11:27:01	1.1
 --- concept_checks.h	2001/03/01 13:54:00
 ***************
 *** 473,479 ****
       return __n;
     }
     template <class _Exp, class _Type, class _Distance>
 !   static _Type
     __element_access_operator_requirement_violation(_Exp __x, _Type*,
                                                     _Distance __n) {
       return __x[__n];
 --- 473,479 ----
       return __n;
     }
     template <class _Exp, class _Type, class _Distance>
 !   static _Type &
     __element_access_operator_requirement_violation(_Exp __x, _Type*,
                                                     _Distance __n) {
       return __x[__n];
 



More information about the Gcc-prs mailing list