Boost logo

Boost :

From: Valentin Bonnard (Bonnard.V_at_[hidden])
Date: 1999-11-13 11:04:40


Beman Dawes wrote:
>
> Darin Adler wrote:
>
> >Dave Abrahams mentioned his operators.h library.
> >
> >I believe that library provides a class template that implements
> operator !=
> >for a subclass based on the operator == in that subclass, using the
> >"curiously-recurring" template pattern.
> >
> >This only works for member function versions of operator ==.
> >
> >But I haven't seen operators.h, I don't think.
>
> Dave and I have been working on finishing touches for operators.hpp,
> documentation, and a test+demonstration program. Should be ready for
> posting sometime next week.
>
> Here is the equality_comparable portion:
>
> template <class T, class U = T>
> class equality_comparable
> {
> friend bool operator==( const U& y, const T& x ) { return x ==
> y; }
> friend bool operator!=( const U& y, const T& x ) { return !(x ==
> y); }
> friend bool operator!=( const T& y, const U& x ) { return !(y ==
> x); }
> };

I don't think that all these versions are really usefull.

I mean, since iterator is implicitly convertable to
const_iterator, it != const_it should be ok, shouldn't it ?

-- 
Valentin Bonnard

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk