This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/2138: trouble with STL's distance function
- To: gcc-bugs at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org, reichelt at igpm dot rwth-aachen dot de
- Subject: Re: c++/2138: trouble with STL's distance function
- From: Wolfgang Bangerth <wolfgang dot bangerth at iwr dot uni-heidelberg dot de>
- 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];