fork download
  1. #include <map>
  2. #include <string>
  3. struct MyClass{ std::string fred; };
  4. int main(){
  5. // assume MyClass has a string var 'fred' and a method 'ethel'
  6. std::map<const char*,MyClass*> MyMap;
  7.  
  8. MyMap[ "A" ] = new MyClass;
  9. MyMap.find( "A" )->second->fred = "I'm a Mertz";
  10.  
  11.  
  12. }
  13.  
Success #stdin #stdout 0.02s 2852KB
stdin
Standard input is empty
stdout
Standard output is empty