I believe I have found another way to figure this out. This, unfortunately, does not work with floats due to restrictions on the use of floating point types in templates, but should work for most other cases (for example, to differentiate between signed and unsigned types):
struct T { enum { signed_t,unsigned_t } m_type; template <typename Signed, std::enable_if_t<std::is_signed<Signed>::value, bool> = true > T(Signed) : m_type(signed_t) {} template <typename Unsigned, std::enable_if_t<std::is_unsigned<Unsigned>::value, bool> = true > T(Unsigned) : m_type(unsigned_t) {} };
Real-time example: http://ideone.com/xqp4nd
source share