Boost logo

Boost :

From: Alex Chovanec (achovane_at_[hidden])
Date: 2004-09-10 20:11:17


David Abrahams" <dave_at_[hidden]> wrote in message
news:ullfibawd.fsf_at_boost-consulting.com...
>
> Don't you think it's time we generalized the hack into a nice macro
> that generates the right code?
>

Agreed. That way we could have utilities like these to check for all unary
operators. In fact, I don't see any reason why the same idea couldn't be
applied to binary operators. I would think that the usage would look
something like this:

    DEFINE_UNARY_OPERATOR_TEST(is_dereferenceable, *);
    DEFINE_BINARY_OPERATOR_TEST(is_addable, +);

Then you could do

    is_dereferenceable<T>

or

    is_addable<T1, T2>

where the latter expression is true if 't1 + t2' is well-formed, where 't1'
is an instance of 'T1 &' and 't2' is an instance of 'T2 &'.

Is this what you had in mind, or close to it?

-- 
Alex Chovanec
NIF and Engineering Division
Computing Applications and Research Department
Lawrence Livermore National Laboratory

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