Boost logo

Boost :

From: Fernando Cacciola (fernando_cacciola_at_[hidden])
Date: 2004-01-16 14:29:01


"David Abrahams" <dave_at_[hidden]> escribió en el mensaje
news:usmiib8jj.fsf_at_boost-consulting.com...
> "Fernando Cacciola" <fernando_cacciola_at_[hidden]> writes:
>
> > This code is a simplier reproduction of the relevant mpl stuff.
> > You'll see at the bottom that the default equal_to implementation
doesn't
> > work when the integral constant is of enumeration type.
> > At least when the enum is wrapped as in "integral_c"
> > My implementation, called "another_equal_to" here, works, but it uses
the
> > actual integral type. (that's _why_ it works I think)
>
> Wouldn't this be a simpler approach?
>
> template< class T1, class T2>
> struct equal_to
> {
> enum { x = (T1::value == T2::value) };
> static const bool value = x;
>
> typedef bool_<value> type;
> };
>
Simpler indeed... and it works!
Thank you,

Fernando Cacciola
SciSoft


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