Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-01-14 15:05:20


"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;
};

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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