|
Boost : |
From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2004-07-22 08:08:45
Giovanni Bajo wrote:
>Arkadiy Vertleyb wrote:
>
> > One more addition to the typeof library is a macro, that, unlike
> > BOOST_TYPEOF(), which removes top-level consts and references,
> > attempts to be closer to the decltype, by preserving lvalue-ness of
> > its argument:
> >
> > BOOST_TYPEOF_PRESERVE_LVALUE(expr)
> >
> > I do admit that the name is quite clumzy :(
>
> BOOST_DECLTYPE?
Well, unfortunately, it's not exactly decltype :(
In particular:
int i;
const int ci = 0;
decltype BOOST_TYPEOF_PRESERVE_LVALUE
-------- ----------------------------
i int int&
ci const int const int&
etc.
It is calculated by binding a T& to the expression. If it can't be bound the
type is the same as one returned by BOOST_TYPEOF. If it can, it's either
reference or const reference, depending on the constness of T.
Any suggestions how to make it closer to the real decltype?
Arkadiy
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk