#include <iostream>
#include <set>
using namespace std;
void funcA()
{
if (static const std::set<std::string> set{ "1234", "4321" }; set.count("1234"))
{
std::cout << 1 << std::endl;
}
else {
std::cout << 0 << std::endl;
}
}
int main()
{
// your code goes here
funcA();
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c2V0Pgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdm9pZCBmdW5jQSgpCnsKCWlmIChzdGF0aWMgY29uc3Qgc3RkOjpzZXQ8c3RkOjpzdHJpbmc+IHNldHsgIjEyMzQiLCAiNDMyMSIgfTsgc2V0LmNvdW50KCIxMjM0IikpCgl7CgkJc3RkOjpjb3V0IDw8IDEgPDwgc3RkOjplbmRsOwoJfQoJZWxzZSB7CgkJc3RkOjpjb3V0IDw8IDAgPDwgc3RkOjplbmRsOwoJfQp9CgppbnQgbWFpbigpCnsKCS8vIHlvdXIgY29kZSBnb2VzIGhlcmUKCWZ1bmNBKCk7CgkKCXJldHVybiAwOwp9
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 {
^~~~