fork(1) download
  1. #include <iostream>
  2. #include <type_traits>
  3.  
  4. template<typename T>
  5. struct Test
  6. {
  7. static_assert(std::is_scalar<T>::value, "Template parameter must be a scalar type");
  8. using SignedT = typename std::conditional<std::is_floating_point<T>::value, std::common_type<T>, std::make_signed<T>>::type::type;
  9. };
  10.  
  11. int main()
  12. {
  13. Test<int> t1;
  14. Test<float> t2;
  15. }
  16.  
Success #stdin #stdout 0s 2848KB
stdin
Standard input is empty
stdout
Standard output is empty