Boost logo

Boost :

Subject: Re: [boost] clang type traits
From: Daniel James (dnljms_at_[hidden])
Date: 2011-06-07 18:41:04


On 28 May 2011 23:47, Bryce Lelbach <blelbach_at_[hidden]> wrote:
> John, Clang has supported GCC style type trait intrinsics (__is_pod, etc) for
> awhile. The <boost/type_traits/intrinsics.hpp> header doesn't detect this. May
> I fix this?

I just noticed this change. To avoid warnings, you should check that a
macro is defined before using it. Common macros can be added to
detail/workaround.hpp to make that easier.

Although in this case I think we should be using clang's feature
checking macros. For example (untested):

    #if defined(__has_extension)

    # if __has_extension(is_union)
    # define BOOST_IS_UNION(T) __is_union(T)
    # endif

    // ....

    #endif

Maybe it should also check for clang first. That's pretty verbose
though, perhaps something to consider for a future release. But it
should be more robust than checking version numbers.


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