This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: missing operator !=
- To: Stefan Seefeld <seefeld at sympatico dot ca>
- Subject: Re: missing operator !=
- From: Pierre Aubert <pierre dot aubert at echo dot fr>
- Date: 20 Mar 2001 08:39:02 +0100
- Cc: libstdc++ at gcc dot gnu dot org
- References: <3AB6DEAE.4020906@sympatico.ca>
Stefan Seefeld <seefeld@sympatico.ca> writes:
> hi there, I'v just tried out a recent gcc snapshot, and I came
> across the following problem:
>
> #include <list>
> #include <iterator>
> #include <cassert>
>
> template <class T>
> class iterator : public std::iterator<std::bidirectional_iterator_tag, T>
> {
> public:
> typedef iterator<T> self;
> friend bool operator == <>(self, self);
> };
>
> template <class T>
> inline bool operator==(iterator<T> x, iterator<T> y) { return true;}
>
> int main(int, char **)
> {
> iterator<int> i, j;
> if (i != j);
> }
>
> The compiler complains about an undefined operator != for the iterators.
> Shouldn't this operator be generated from the existing operator == ?
> Am I missing an include ?
I think generic operator!= is in namespace std::rel_ops and not in std
--
Pierre F. Aubert pierre.aubert(at)echo.fr
http://pierre(dot)aubert(dot)free(dot)fr pierre.aubert(at)free.fr