Consider the following code:

std::map<std::string, int> m1;
auto i = m1.find("foo");

const char* key = ...
auto j = m1.find(key);

This will create a temporary std::string object for every map lookup. What are the canonical ways to avoid it?

Edit
Report