Speclib  0.1.2
The library for writing better CUDA libraries
sp::make_signed< T, Q > Struct Template Reference

Like std::make_signed, but returns the input type if it is non-integer. More...

#include <TypeTraits.hpp>

Public Types

typedef T type
 

Detailed Description

template<typename T, typename Q = void>
struct sp::make_signed< T, Q >

Like std::make_signed, but returns the input type if it is non-integer.

This is necessary because std::make_signed has undefined behaviour for non-integer input types, which turns out to be inconvenient sometimes. For that reason, we also can't use SFINAE to directly check for the nonexistence of std::make_signed_t<...>, since it is not defined that this won't exist for non-integer types.

Note, also, that we have to use our own version of is_integral here, since the STL one is defined to yield false for unsigned integers, for some insane reason.