Yes, in C++ simply writing "apple" will give a string literal.

In your first example the compiler knows to convert this argument into an std::string, because that is the type that your map1 expects. Whereas in your second example your templated getkey function receives the two types, std::string from the type of map2 and the string literal from the parameter you gave, and is unable to know which way to convert them without some kind of a hint.
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence