fork download
  1. //
  2. template<typename U = std::enable_if<std::is_floating_point<U>::value>::type>
  3. static bool is_equal(U left, U right)
  4. {
  5. return (std::abs(left - right) < 0);
  6. }
  7.  
  8. //
  9. template<typename U = std::enable_if<std::is_integral<U>::value>::type>
  10. static bool is_equal(U left, U right)
  11. {
  12. return (left == right);
  13. }
  14.  
  15. int main() {}
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:2:28: error: 'enable_if' in namespace 'std' does not name a template type
 template<typename U = std::enable_if<std::is_floating_point<U>::value>::type>
                            ^
prog.cpp:2:37: error: expected '>' before '<' token
 template<typename U = std::enable_if<std::is_floating_point<U>::value>::type>
                                     ^
prog.cpp: In function 'bool is_equal(U, U)':
prog.cpp:5:13: error: 'abs' is not a member of 'std'
     return (std::abs(left - right) < 0);
             ^
prog.cpp: At global scope:
prog.cpp:9:28: error: 'enable_if' in namespace 'std' does not name a template type
 template<typename U = std::enable_if<std::is_integral<U>::value>::type>
                            ^
prog.cpp:9:37: error: expected '>' before '<' token
 template<typename U = std::enable_if<std::is_integral<U>::value>::type>
                                     ^
prog.cpp:10:13: error: redefinition of 'template<class U> bool is_equal(U, U)'
 static bool is_equal(U left, U right)
             ^
prog.cpp:3:13: note: 'template<class U> bool is_equal(U, U)' previously declared here
 static bool is_equal(U left, U right)
             ^
stdout
Standard output is empty