fork download
  1. #include <map>
  2. #include <string>
  3. #include <iostream>
  4.  
  5. int main()
  6. {
  7. std::map<std::string, int> m;
  8. m["foo"]=42;
  9. m["bar"]=42;
  10.  
  11. bool notExists = m.find("foo")==m.end();
  12. std::cout << ( notExists ? "NO\n" : "YES\n");
  13.  
  14. notExists = m.find("bar")==m.end();
  15. std::cout << ( notExists ? "NO\n" : "YES\n");
  16.  
  17. notExists = m.find("baz")==m.end();
  18. std::cout << ( notExists ? "NO\n" : "YES\n");}
Success #stdin #stdout 0s 3032KB
stdin
Standard input is empty
stdout
YES
YES
NO