fork(2) download
  1. #include <type_traits>
  2. #include <complex>
  3. template<class T>
  4. struct is_complex_or_floating_point : std::is_floating_point<T> { };
  5.  
  6. template<class T>
  7. struct is_complex_or_floating_point<std::complex<T>> : std::is_floating_point<T> { };
  8.  
  9. int main()
  10. {
  11. static_assert(!is_complex_or_floating_point<int>::value, "");
  12. static_assert(is_complex_or_floating_point<float>::value, "");
  13. static_assert(is_complex_or_floating_point<double>::value, "");
  14. static_assert(is_complex_or_floating_point<std::complex<float>>::value, "");
  15. static_assert(is_complex_or_floating_point<std::complex<double>>::value, "");
  16. }
Success #stdin #stdout 0s 3336KB
stdin
Standard input is empty
stdout
Standard output is empty