This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [v3] ext/type_traits.h
> In the use cases I've personally been involved with, I had an
> integral type T which could be either signed or unsigned, and I
> needed to get its unsigned counterpart (or signed counterpart).
> Actually the former (unsigned counterpart) was my more common need.
> Having to spell that typename __add_unsigned<typename
> __remove_signed<T>::type>::type seems cumbersome.
All this seems unduly complicated to me.
TR1 already has traits for is_signed or is_unsigned. Together with
__conditional_type (hopefully spelled conditional_type in TR2 or wherever) gives:
// To get unsigned type.
conditional_type(is_signed<T>::value, add_unsigned<T>::type, T)
This seems reasonable to me, and quite readable.
?
C++ doesn't currently have "to" traits or utils. Why add them? If you
add this, will "to_const" be next?
;)
-benjamin