[v3] ext/type_traits.h
Martin Sebor
sebor@roguewave.com
Thu Sep 28 20:22:00 GMT 2006
Howard Hinnant wrote:
> On Sep 28, 2006, at 1:35 PM, Gennaro Prota wrote:
>
>> On Thu, 28 Sep 2006 12:23:51 -0400, Howard Hinnant
>> <hhinnant@apple.com> wrote:
>>
>>>> Btw., we've also had the need for signed/unsigned conversion in
>>>> our library in the past. We dealt with it by adding a typedef or
>>>> two to numeric_limits, something like this (we don't have them
>>>> anymore but at one point private versions of them were in there):
>>>>
>>>> numeric_limits<T>::signed_type
>>>> numeric_limits<T>::unsigned_type
>>>
>>>
>>> Thanks for the data point. Imho that puts us a notch closer to a
>>> proposal.
>>
>>
>> You don't mean a proposal to add them to numeric_limits, do you?
>> (Sorry, just to be sure! :-))
>
>
> My personal hat on: I hope not.
>
> My LWG Chair hat on: The LWG will entertain all reasonable proposals.
I have no plans to write up a proposal for this but I'd have
no problem with one that called for adding these typedefs to
numeric_limits (they would fit in with the is_signed member).
The standalone add_unsigned critters would be okay too. They
would be in line with all the other little traits classes. I
don't see a big advantage of one approach over the other.
Except perhaps that the compiler would have to parse all the
type traits classes even when all that was needed were a
conversion from unsigned to signed or vice versa (although
parsing limits wouldn't be that much less expensive, either).
Seems like a lot of CPU cycles for something so trivial. But
I guess that's nothing new in C++ ;-)
Martin
More information about the Libstdc++
mailing list