Boost logo

Boost :

Subject: Re: [boost] [typeof] Weird VC++ compiler bug
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2015-05-27 10:18:07


---------- Forwarded message ----------
From: Andrey Semashev <andrey.semashev_at_[hidden]>
Date: 2015-05-27 16:06 GMT+02:00
Subject: Re: [boost] [typeof] Weird VC++ compiler bug
To: "boost_at_[hidden]" <boost_at_[hidden]>

On Wed, May 27, 2015 at 4:53 PM, Andrzej Krzemienski <akrzemi1_at_[hidden]>
wrote:
> 2015-05-23 18:33 GMT+02:00 Steven Watanabe <watanabesj_at_[hidden]>:
>
>> AMDG
>>
>> On 05/23/2015 09:44 AM, Peter Dimov wrote:
>> >
>> > Why doesn't Typeof use decltype on VS 2013?
>> >
>>
>> Probably because Typeof hasn't had a maintainer
>> since before decltype. It doesn't appear to
>> use decltype for any compiler.
>>
>
> I don't think it can. The semantics of BOOST_TYPEOF is that of:
> auto x = expr;
>
> The semantics of decltype are quire different. For instance, auto and
> BOOST_TYPEOF and GCC's __typeof__ never deduce references -- always
values.
> decltype on the other hand can deduce references.

As long as BOOST_TYPEOF is less precise than decltype it can be
emulated, can it not?

You're right it can. I think the following would work:
typename std::decay<decltype(expr)>::type

Regards,
&rzej


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