Boost logo

Boost :

Subject: Re: [boost] review request: addition to type_traits library of has_operator_xxx
From: Frédéric Bron (frederic.bron_at_[hidden])
Date: 2010-11-29 04:53:52


> To take care of operators involving *only* builtin types, I dispatch to
> another metafunction, which might be preferable to listing out all the
> special cases of combinations of builtin types.

Could you give an example? I do not understand clearly what you mean.
Problem here is that for example (double % double) yields a compile
time error and that it is not possible to overload operator%(built-in
type, built-in type).
So if you have a solution that replaces a long list of template
specialization by much fewer lines, please propose.

> Actually, I'm not entirely
> sure how you cover builtin types.  I see in has_operator_bit_and.hpp that
> you list combinations of builtin types that *don't* have the bitand operator
> is this list suppose to be exhaustive?

Yes it is supposed to be exhaustive.

> I still think one should be able to pass a metafunction to an operator trait
> to be invoked on the actual result type of the operation, but that's more of
> a feature request than an implementation comment.

I will first try to comply to all other request, i.e. (i) extension to
all operators (already done <<, >> and op=), (ii) use existing
is_convertible<T>.
Then, maybe you could add your proposal as a later addition.

Frédéric


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