fork(4) download
  1. #include <iostream>
  2. #include <map>
  3. #include <cstring>
  4.  
  5. struct myComp
  6. {
  7. bool operator()(const char* s1, const char* s2) const
  8. {
  9. return strcmp(s1, s2) < 0;
  10. }
  11. };
  12.  
  13. int main()
  14. {
  15. std::map<const char*, int, myComp> test;
  16.  
  17. test["$"] = 1;
  18. test["#"] = 2;
  19.  
  20. std::cout << "$ -> " << test["$"] <<"\n";
  21. std::cout << "# -> " << test["#"] <<"\n";
  22.  
  23. return 0;
  24. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
$ -> 1
# -> 2