fork(1) download
  1. #include <vector>
  2. #include <map>
  3. #include <string>
  4.  
  5. class Base {
  6. };
  7.  
  8. class Derived : public Base {
  9. };
  10.  
  11. using MyMap = std::map<std::string, std::vector<Base*>>;
  12.  
  13. int main() {
  14. Base* tanuki = new Derived;
  15.  
  16. MyMap myMap;
  17. auto it = myMap.find("racoon");
  18. if (it == myMap.end())
  19. myMap.insert(std::make_pair<std::string, std::vector<Base*>>("racoon", {tanuki}));
  20. else
  21. it->second.push_back(tanuki);
  22.  
  23. return 0;
  24. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
Standard output is empty