Boost logo

Boost :

Subject: Re: [boost] [type_traits] Big changes in develop
From: Peter Dimov (lists_at_[hidden])
Date: 2015-05-28 09:16:34


> > 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.

Yes, the code in common_type_imp.hpp does something along the lines of my
initial suggestion.

It looks to me that following the ?: specification as in

> - if T and U are the same type, T

- if T is V cv1 & and U is V cv2 &, V cv12 &
(I missed this bullet)

> - 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"

would actually be easier to follow and more correct. The "usual arithmetic
conversions" can be implemented simply by testing all of the arithmetic
types, instead of

* define the set of NominalCandidates to be
* {
* unsigned_soft(T'),
* unsigned_soft(U'),
* signed_soft(T'),
* signed_soft(U'),
* T',
* U',
* unsigned int,
* int
* }

as the code does now.

"Composite pointer type" is a bit more complicated, but I don't see any
tests for it. :-) (The composite type of int*** and int const*** is int
const* const* const*.)


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