I am trying to get automatic template argument deduction to work in C++. I have written a function which accepts a std::map with any two arbitrary types as its input, and returns a variable with the first type as its output. The following example works and compiles successfully: ``` std::map<std::string, int> map1; map1["apple"] = 1; string key1 = getkey(map1, 1); ``` The following does not: ``` std::map<int, std::string> map2; map2[1] = "apple"; int key2 = getkey(map2, "apple"); ``` The compiler says it cannot deduce the types used by the map. What is the cause of this?