Subject: Re: [boost] [type_traits] Big changes in develop
From: Peter Dimov (lists_at_[hidden])
Date: 2015-05-27 09:12:40


John Maddock wrote:
> On 27/05/2015 07:11, Vicente J. Botet Escriba wrote:
> > We will need a patch that works for the versions of SunPro providing
> > __typeof__. But shouldn't this be part of Boost.Typeof? Could you
> > provide such a patch?
>
> Yes Boost.Typeof needs patching as well, ...

Boost.Typeof already appears to use __typeof__:

#elif defined(__SUNPRO_CC)
# if (__SUNPRO_CC < 0x590 )
# ifdef BOOST_TYPEOF_NATIVE
# error native typeof is not supported
# endif
# ifndef BOOST_TYPEOF_EMULATION
# define BOOST_TYPEOF_EMULATION
# endif
# else
# ifndef BOOST_TYPEOF_EMULATION
# ifndef BOOST_TYPEOF_NATIVE
# define BOOST_TYPEOF_NATIVE
# endif
# define BOOST_TYPEOF_KEYWORD __typeof__
# endif
# endif

> ... but note that since one goal of the rewrite is to reduce the libraries
> dependencies, Boost.Typeof is used as a last resort in common_type, and
> typeof is used directly when available.

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?