This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
relax requirements for vector==
- To: gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Subject: relax requirements for vector==
- From: veksler at il dot ibm dot com
- Date: Tue, 6 Mar 2001 12:59:21 +0200
The problem:
When value type of vector has operator== and has not operator!= (it is not
strictly EqualityComparable), vector::operator== will not compile. Although
this may be correct according to the standard (?), it is a dumb behavior
and should be fixed.
I grepped all of the includes, to make sure there are no more similar
instances:
find libstdc++-v3/include -type f | xargs grep '\!= *\*'
This matched only 2 cases:
1. locale_facets.tcc (_CharT::operator!=)
2. stl_algobase.h (our case)
The patch:
Index: libstdc++-v3/include/bits/stl_algobase.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/stl_algobase.h,v
retrieving revision 1.3
diff -u -r1.3 stl_algobase.h
--- stl_algobase.h 2001/01/25 15:35:10 1.3
+++ stl_algobase.h 2001/03/06 10:28:42
@@ -599,7 +599,7 @@
__STL_REQUIRES(typename iterator_traits<_InputIter2>::value_type,
_EqualityComparable);
for ( ; __first1 != __last1; ++__first1, ++__first2)
- if (*__first1 != *__first2)
+ if (!(*__first1 == *__first2))
return false;
return true;
}