Boost logo

Boost :

Subject: Re: [boost] [type trait extension] I hate volatile...
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2011-07-17 15:50:09


2011/7/17 Frédéric Bron <frederic.bron_at_[hidden]>

> > What does your code look like that detects void types? I use the
> following
> > EXPR_IS_VOID macro myself (which is not originally mine, but I think I
> have
> > modified it from the original after some testing); feel free to pilfer.
> The
> > double comma operator thingy is intended to work even if the type of (
> Expr
> > ) has an overloaded comma operator, but I've found that GCC has issues
> with
> > this construct, hence the two versions.
> >
> > #define EXPR_IS_VOID( Expr ) \
> > EXPR_IS_CONVERTIBLE( \
> > ( ( Expr ), ::detail_expr_is_void::void_detector_t() ), \
> > ::detail_expr_is_void::void_detector_t \
> > )
>
> Interesting: I do not have a series of 2 operator, but instead have
> non_void_t operator,(const T&, void_detector_t) declared.
> I will check if your implementation gives something better. Thanks a
> lot for your contribution.
>

I forgot to mention that I only verified that expression types with volatile
qualification didn't affect EXPR_IS_VOID on MSVC9; I didn't check GCC,
so...given the 2 different implementations, you might still have issues :(
More recent versions of GCC may accept the double comma trick; I don't know
if it's using non-standard behavior or not :/

- Jeff


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