Implement 2735 by checking to make sure argument both is_integral and not is_unsigned.
Question
The issue describes abs returning an int always but for larger int types this would not work. I assume checking to make sure they are integral types is okay, but I am not sure.
TODO
- write tests (make sure unsigned ints fail)
I think these tests are nonportable. The assumption here is that int32_t (and others) are smaller than (or the same size as) int, and int64_t is larger.
Maybe you want a little type trait (untested)
template <typename T> struct smaller_than_int { typedef typename std::conditional<sizeof(T) < sizeof(int), int, T>::type type; };and then write test_abs<std::int8_t, smaller_than_int <std::int8_t>();