fork download
  1. #include <iostream>
  2. #include <type_traits>
  3.  
  4. template <typename T, typename = void>
  5. struct SH_trait
  6. {
  7. typedef std::string type;
  8. };
  9.  
  10. template <typename T>
  11. struct SH_trait<T, typename std::enable_if<std::is_integral<T>::value>::type>
  12. {
  13. typedef double type;
  14. };
  15.  
  16. int main()
  17. {
  18. static_assert( std::is_same<SH_trait<int>::type, double>::value, "" );
  19. }
Success #stdin #stdout 0s 2892KB
stdin
Standard input is empty
stdout
Standard output is empty