Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2007-07-27 16:38:57


"Doug Gregor" <dgregor_at_[hidden]> wrote

>> "Doug Gregor" <dgregor_at_[hidden]> wrote
>>
>>> I meant, why not have the typeof library use decltype when it is
>>> available? You can just predicate on BOOST_HAS_DECLTYPE, and of
>>> course test with the latest GCC 4.3.
>>
>> I think BOOST_TYPEOF should continue returning consistent result
>> across the
>> compilers. For this, if we used decltype, we would need to remove
>> top-level
>> consts and refs... which doesn't seem to make a lot of sense...
>
> typename remove_cv<typename remove_reference<decltype(EXPR)
> >::type>::type
>
> is still a lot simpler than what BOOST_TYPEOF has to go through to
> get the type of an expression... you could save a lot of compile time
> using decltype.

Well, if typeof is available, BOOST_TYPEOF does use it rather than perform
the emulation, so it's rather something like:

#define BOOST_TYPEOF(expr) typeof(expr)

(or almost like this)

>> Does GCC 4.3 still have typeof?
>
> It's still there, although I don't know how useful it is.

Doesn't GCC care about backward compatibility?

Regards,
Arkadiy


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