fork(2) download
  1. #include <iostream>
  2. #include <set>
  3. using namespace std;
  4.  
  5. void funcA()
  6. {
  7. if (static const std::set<std::string> set{ "1234", "4321" }; set.count("1234"))
  8. {
  9. std::cout << 1 << std::endl;
  10. }
  11. else {
  12. std::cout << 0 << std::endl;
  13. }
  14. }
  15.  
  16. int main()
  17. {
  18. // your code goes here
  19. funcA();
  20.  
  21. return 0;
  22. }
Compilation error #stdin compilation error #stdout 0s 15240KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘void funcA()’:
prog.cpp:7:6: error: decl-specifier invalid in condition
  if (static const std::set<std::string> set{ "1234", "4321" }; set.count("1234"))
      ^~~~~~
prog.cpp:7:62: error: expected ‘)’ before ‘;’ token
  if (static const std::set<std::string> set{ "1234", "4321" }; set.count("1234"))
                                                              ^
prog.cpp:7:62: error: could not convert ‘set’ from ‘const std::set<std::__cxx11::basic_string<char> >’ to ‘bool’
prog.cpp:7:67: error: missing template arguments before ‘.’ token
  if (static const std::set<std::string> set{ "1234", "4321" }; set.count("1234"))
                                                                   ^
prog.cpp:11:2: error: ‘else’ without a previous ‘if’
  else {
  ^~~~
stdout
Standard output is empty