Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2001-01-21 23:55:27


----- Original Message -----
From: "Howard Hinnant" <hinnant_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Sunday, January 21, 2001 11:03 PM
Subject: Re: [boost] More type_traits confusion

> is_standard_signed_integral<char>::value returns false everywhere (by
> design). If char is a signed quantity on the compilers you are testing,
> then this is to be expected.

Sorry, when you wrote:
> >> >> Note that is_signed<char>::value is both well formed and
well-defined,
> >> >> though its result will vary with implementations.

I thought you were talking about is_signed_integral<char>::value

I think having is_standard_signed_integral<char>::value == false arguably
makes sense.
But then, is_signed_integral<T> is extends is_standard_signed_integral<T> to
cover nonstandard types. The idea is presumably to get an answer for all
compiler-supplied types.
Having it return false for T == char is pretty weird.
From the usability standpoint, anyone can look in the standard to find out
that chars aren't /required/ to be signed, but it's really useful to know if
a char /is/ signed on any given implementation.

That's why I'm trying to say we need to be clearer about what type_traits is
doing. If you defend the current behavior, you have to accept that it's not
really about general type introspection, though it has templates whose names
strongly suggest that it is. If that's the case, we need to document it very
clearly.

-Dave


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