Question about operator!=() in stl_relops.h
George T. Talbot
george@moberg.com
Mon Apr 3 09:25:00 GMT 2000
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>
More information about the Libstdc++
mailing list