This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c++0x vs. tr1 type_traits, round 1


On Apr 26, 2007, at 7:15 AM, Benjamin Kosnik wrote:

Also something that struck me as strange is that make_unsigned<wchar_t> gives unsigned wchar_t, but is_unsigned<wchar_t> doesn't work.

Either the algebra seems off, or my understanding is incomplete.

Sorry for the slow response. I'm not sure what this statement means. Let me start of with my understanding of how these work:


is_unsigned<wchar_t> should return wchar_t(-1) > wchar_t(0). I'm unclear why that doesn't work.

Since there is no such thing as unsigned wchar_t, make_unsigned<wchar_t> should give the first out of the following list:

unsigned char
unsigned short
unsigned int
unsigned long
unsigned long long
extended unsigned integer type

which has the same sizeof as wchar_t.

If there's anything I can do to help, I'm happy to. I'd be happy to post an implementation of make_(un)signed. It is essentially built out of type lists (one list for signed integral types and one list for unsigned integral types). bool, char and wchar_t, according to 3.9 are neither, though for sanity purposes, they do react to is_(un) signed in the intuitive fashion instead of according to 3.9. Perhaps this is what you are referring to as the algebra being off?

-Howard


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]