Why this piece of code compiles?
#include <string>
#include <variant>
#include <map>
void foo(std::map<int, std::variant<int, std::string>> map)
{}
int main()
{
foo({{1,"1"}, {2, 2}});
}
We have {{1,"1"}, {2, 2}} thing which std::map should be initialized with. It probably has something to do with the std::map ctor which accepts std::initializer_list & list-initialization. But I wonder how this thing {{1,"1"}, {2, 2}} may compile at all? What type it has? How overload resolution works in this case?