Boost logo

Boost :

From: Howard Hinnant (hinnant_at_[hidden])
Date: 2002-10-28 07:54:51


On Sunday, October 27, 2002, at 10:58 PM, Gabriel Dos Reis wrote:

> The way I'm intending to implement compiler support for type traits in
> GCC is to have "built-in" operators like __builtin_xxx() (xxx ranging
> over is_pod, has_trivial_copy_ctor, has_trivial_dtor, ...) to take a
> type-id and return boolean constant expression.
>
> Therefore,
>
> | template< typename T > struct is_pod
> | {
> | BOOST_STATIC_CONSTANT(bool, value =
>
> will be written
>
> BOOST_STATIC_CONSTANT(bool, value = __builtin_is_pod(T))

Ditto for Metrowerks. We already have several __builtin_xxx. For
example in Pro 8 we shipped:

template <class T> struct is_union_imp
    {static const bool value = __builtin_type(T) == 0x2001;};

where is_union_imp is in details and implements is_union. The set of
__builtin_xxx isn't complete but is growing.

-Howard


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