[v3] add_unsigned/remove_unsigned tweaks

Howard Hinnant hhinnant@apple.com
Fri Sep 29 15:42:00 GMT 2006


On Sep 29, 2006, at 8:28 AM, Benjamin Kosnik wrote:

>
> Adds in signed char bits as discussed by Paolo and Howard, and tests.
>
> In addition, this adds compile-time warnings on things like
>
> __gnu_cxx::__remove_unsigned<float>::__type
> __gnu_cxx::__add_unsigned<bool>::__type
>
> Even though these constructs are admittedly bizarre, it looks like  
> this "trait" is
> converging on semantic meaning, and signed-ness means nothing for
> floating point types. (Last time I checked.)
>
> tested x86/linux

Clever use of enable_if in the primary.

Do we think that having both std::tr1::is_integral<T>::value (now in  
the WP as std::is_integral<T>::value), and  
std::__is_integer<T>::__value *and* having them mean two different  
things is error prone or confusing?

#include <tr1/type_traits>
#include <iostream>

int main()
{
     std::cout << std::tr1::is_integral<const int>::value << '\n';
     std::cout << std::__is_integer<const int>::__value << '\n';
}

I'm asking because __add_unsigned builds on __is_integer and impacts  
how we handle __add_unsigned with cv-qualified integral types.

-Howard



More information about the Gcc-patches mailing list