fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template <class T>
  5. bool greater (const T&a, const T&b) { return true; } // moze greater() jest w super_tajna_biblioteka, nie wiem, bez tego nie działa to pomyslalem, ze includa nie ma
  6.  
  7.  
  8. template <class T, typename comp = greater<T> >
  9. class klasa {
  10. public:
  11. klasa(const T &a, const T &b) {
  12. cout << comp(a, b);
  13. }
  14. };
  15.  
  16. int main() {
  17. klasa<int> a(1, 2);
  18. return 0;
  19. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:8:36: error: expected type-specifier before ‘greater’
 template <class T, typename comp = greater<T> >
                                    ^
prog.cpp:8:36: error: expected ‘>’ before ‘greater’
prog.cpp: In function ‘int main()’:
prog.cpp:17:11: error: template argument 2 is invalid
  klasa<int> a(1, 2);
           ^
prog.cpp:17:14: error: invalid type in declaration before ‘(’ token
  klasa<int> a(1, 2);
              ^
prog.cpp:17:19: error: expression list treated as compound expression in initializer [-fpermissive]
  klasa<int> a(1, 2);
                   ^
prog.cpp:17:19: warning: left operand of comma operator has no effect [-Wunused-value]
prog.cpp:17:13: warning: unused variable ‘a’ [-Wunused-variable]
  klasa<int> a(1, 2);
             ^
stdout
Standard output is empty