fork download
  1. #include <iostream>
  2. #include <complex>
  3. #include <type_traits>
  4.  
  5. namespace std {
  6.  
  7. template< class T >
  8. struct is_floating_point<std::complex<T>> : std::integral_constant<
  9. bool,
  10. std::is_same<float, typename std::remove_cv<T>::type>::value ||
  11. std::is_same<double, typename std::remove_cv<T>::type>::value ||
  12. std::is_same<long double, typename std::remove_cv<T>::type>::value
  13. > {};
  14.  
  15. }
  16.  
  17. int main() {
  18. std::cout << std::boolalpha << std::is_floating_point<double>::value << std::endl;
  19. std::cout << std::boolalpha << std::is_floating_point<std::complex<double>>::value << std::endl;
  20. std::cout << std::boolalpha << std::is_floating_point<std::complex<long double>>::value << std::endl;
  21. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
true
true
true