Boost logo

Boost :

Subject: Re: [boost] [type_traits] Big changes in develop
From: Peter Dimov (lists_at_[hidden])
Date: 2015-05-28 08:50:06


John Maddock wrote:
> > Do we have to use Typeof in common_type at all? In the cases in which
> > common_type<T, U>::type is either T or U, can we not find that out by
> > using two overloads? Is this not good enough?
>
> Wouldn't that fail where promotions are involved for example with enum
> types?

Yes, it's not as I specified. The proper procedure for ?: is actually

- if T and U are the same type, T
- if T or U is a class type
    - if T converts to U and U does not convert to T, U
    - if U converts to T and T does not convert to U, T
    - otherwise error
- if T and U are arithmetic or enumerations, "usual arithmetic conversions"
- if T and U are pointers, "composite pointer type"

There's no need for typeof anywhere, as far as I can see.

> In any case this is basically what happens when
> BOOST_COMMON_TYPE_DONT_USE_TYPEOF and BOOST_NO_CXX11_DECLTYPE are set.

I'll take a look.


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