Boost logo

Boost :

Subject: Re: [boost] review request: addition to type_traits library of has_operator_xxx
From: Jeffrey Lee Hellrung, Jr. (jhellrung_at_[hidden])
Date: 2010-11-26 18:54:17


On 11/16/2010 3:49 PM, Frédéric Bron wrote:
> I would like to propose to your review the following addition to the
> type_traits library, available at the following addresses:
> https://svn.boost.org/trac/boost/browser/sandbox/type_traits
> http://dl.free.fr/lRm4VL6WP/type_traits.tar.bz2
[...]

I have a few comments on the implementation.

On MSVC (at least), you can do a bit better in detecting whether
expressions have a void type, even if type of the expression has an
overloaded comma operator. However, it doesn't work with GCC (as far as
I know), so I don't know if it's of any interest. Let me know.

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. 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 (side note: shouldn't we stick to
standard spellings here, e.g., "bitand" over "bit_and"?); is this list
suppose to be exhaustive?

Other than that, the implementation is essentially identical to my own
solution.

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.

- Jeff


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