fork(4) download
  1. #include <iostream>
  2.  
  3. template<typename T, T N, T M>
  4. struct is_greater_than<void, N, M>;
  5.  
  6. template<typename T = std::enable_if<std::is_integral<T>::value, T>::value, T N, T M>
  7. struct is_greater_than<T, N, M>
  8. {
  9. static const bool value = N > M;
  10. };
  11.  
  12. int main()
  13. {
  14. bool test0 = is_greater_than<int, 1, 2>::value;
  15. bool test1 = is_greater_than<int, 1, 1>::value;
  16. bool test2 = is_greater_than<int, 2, 1>::value;
  17. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:4:8: error: ‘is_greater_than’ is not a class template
 struct is_greater_than<void, N, M>;
        ^
prog.cpp:6:55: error: ‘T’ was not declared in this scope
 template<typename T = std::enable_if<std::is_integral<T>::value, T>::value, T N, T M>
                                                       ^
prog.cpp:6:56: error: template argument 1 is invalid
 template<typename T = std::enable_if<std::is_integral<T>::value, T>::value, T N, T M>
                                                        ^
prog.cpp:6:66: error: ‘T’ was not declared in this scope
 template<typename T = std::enable_if<std::is_integral<T>::value, T>::value, T N, T M>
                                                                  ^
prog.cpp:6:67: error: template argument 1 is invalid
 template<typename T = std::enable_if<std::is_integral<T>::value, T>::value, T N, T M>
                                                                   ^
prog.cpp:6:67: error: template argument 2 is invalid
prog.cpp:6:70: error: expected ‘>’ before ‘value’
 template<typename T = std::enable_if<std::is_integral<T>::value, T>::value, T N, T M>
                                                                      ^
prog.cpp:7:27: error: ‘N’ was not declared in this scope
 struct is_greater_than<T, N, M>
                           ^
prog.cpp:7:30: error: ‘M’ was not declared in this scope
 struct is_greater_than<T, N, M>
                              ^
prog.cpp:7:31: error: template argument 2 is invalid
 struct is_greater_than<T, N, M>
                               ^
prog.cpp:7:31: error: template argument 3 is invalid
prog.cpp: In function ‘int main()’:
prog.cpp:14:15: error: incomplete type ‘is_greater_than<int, 1, 2>’ used in nested name specifier
  bool test0 = is_greater_than<int, 1, 2>::value;
               ^
prog.cpp:15:15: error: incomplete type ‘is_greater_than<int, 1, 1>’ used in nested name specifier
  bool test1 = is_greater_than<int, 1, 1>::value;
               ^
prog.cpp:16:15: error: incomplete type ‘is_greater_than<int, 2, 1>’ used in nested name specifier
  bool test2 = is_greater_than<int, 2, 1>::value;
               ^
prog.cpp:14:7: warning: unused variable ‘test0’ [-Wunused-variable]
  bool test0 = is_greater_than<int, 1, 2>::value;
       ^
prog.cpp:15:7: warning: unused variable ‘test1’ [-Wunused-variable]
  bool test1 = is_greater_than<int, 1, 1>::value;
       ^
prog.cpp:16:7: warning: unused variable ‘test2’ [-Wunused-variable]
  bool test2 = is_greater_than<int, 2, 1>::value;
       ^
stdout
Standard output is empty