fork download
  1. #include <iostream>
  2. #include <set>
  3.  
  4. using namespace std;
  5.  
  6. std::set<int, struct {
  7. bool operator ()(const int* a, const int* b) const
  8. {
  9. return *a < *b;
  10. }
  11. }> test;
  12.  
  13. int main()
  14. {
  15. std::cout << test.size();
  16. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:6:22: error: types may not be defined in template arguments
 std::set<int, struct {
                      ^
prog.cpp:11:2: error: expected ‘;’ after struct definition
  }> test;
  ^
prog.cpp:11:2: error: expected template-argument before ‘;’ token
prog.cpp:11:2: error: expected ‘>’ before ‘;’ token
prog.cpp:11:2: error: expected ‘::’ before ‘;’ token
prog.cpp:11:2: error: expected unqualified-id before ‘;’ token
prog.cpp:11:2: error: declaration does not declare anything [-fpermissive]
prog.cpp:11:3: error: expected unqualified-id before ‘>’ token
  }> test;
   ^
prog.cpp: In function ‘int main()’:
prog.cpp:15:15: error: ‘test’ was not declared in this scope
  std::cout << test.size();
               ^
stdout
Standard output is empty