This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
Question about operator!=() in stl_relops.h
- To: libstdc++ List <libstdc++ at sourceware dot cygnus dot com>
- Subject: Question about operator!=() in stl_relops.h
- From: "George T. Talbot" <george at moberg dot com>
- Date: Mon, 03 Apr 2000 12:27:03 -0400
- Organization: Moberg Research, Inc.
I have a problem with the old standard C++ library (g++-3, not g++-v3).
from stl_relops.h:
template <class _Tp>
inline bool operator!=(const _Tp& __x, const _Tp& __y) {
return !(__x == __y);
}
The problem with this is that it makes it extremely hard to overload != using
a template for one of one's own classes:
From my own header:
template <class T, class T2>
inline bool operator!=(Ptr<T> a, Ptr<T2> b) throw ()
{
return a.ptr() != b.ptr();
}
If both of these headers are included together, then compilation doesn't
work. If I remove mine, I've gotta include stl_relops.h in my file.
Is it part of the standard to have operator!= defined this way? If so, which
header file should I include in my header file to get it? Will g++-v3 do
this? Will I include the same header file?
Thanks.
--
George T. Talbot
<george at moberg dot com>