[PATCH] c++, libstdc++: Add __make_signed and __make_unsigned intrinsic traits
Jonathan Wakely
jwakely@redhat.com
Mon Nov 9 11:05:51 GMT 2026
On Mon, 09 Nov 2026 at 10:46 +0000, Jonathan Wakely wrote:
>On Sat, 07 Nov 2026 at 15:00 +0100, Jakub Jelinek wrote:
>>Another complication is that simd_details.h was using __make_unsigned
>>trait instead of make_unsigned and was doing that intentionally, seems
>>it wants make_unsigned<_From>::type if the type is integral and
>>_From otherwise. Dunno if what I wrote is the simplest.
>
>It looks good to me.
I suppose an alternative would be:
template<typename _Tp>
using __maybe_make_unsigned
= typename __conditional_t<integral<_Tp>, make_unsigned<_Tp>,
type_identity<_Tp>>::type;
That would only instantiate the __conditional<bool> class template,
without defining and instantiating a new class template just for this
purpose.
Your version is arguably simpler to understand though.
More information about the Libstdc++
mailing list