[llvm-dev] Question about std::map

Paul C. Anagnostopoulos via llvm-dev llvm-dev at lists.llvm.org
Thu Dec 3 16:19:00 PST 2020


I have the following map:

  std::map<std::string, std::vector<Record *>> ClassRecordsMap;

I call a function that builds a new vector of <Record *> and returns it.

  const auto Records = getAllDerivedDefinitions(makeArrayRef(ClassName));

What is the best way to add it to the map, being careful not to copy it? This is what I'm doing now:

  ClassRecordsMap[ClassNameString] = std::move(Records);



More information about the llvm-dev mailing list