[Patch] libstdc++/31426 & C++0x type_traits

Howard Hinnant hhinnant@apple.com
Thu May 31 13:26:00 GMT 2007


On May 30, 2007, at 4:14 PM, Paolo Carlini wrote:

> By the way, if you are willing to implement the C++0x behavior for  
> is_signed / is_unsigned, just let me know. I'm asking specifically  
> asking that because apparently will imply some small tweaks to  
> make_signed / make_unsigned (your baby ;) : if you have a plain  
> char type, which happens to be signed on a given platform (i.e.,  
> type(-1) < type(0)), the current implementation of make_signed  
> "returns" the type as-is, doesn't produce signed char, and a test  
> fails (together with my draft implementation of the C++0x is_signed).

Fwiw, here's a reference implementation of make_signed /  
make_unsigned which is independent of is_signed / is_unsigned and  
works whether char is signed or unsigned.

http://home.twcny.rr.com/hinnant/cpp_extensions/make_signed.html

This will work with the new char16_t and char32_t types as well.  If  
there exist extended integer types, then they would need to be added  
to the various lists (4 places).

-Howard



More information about the Libstdc++ mailing list