关于multimap,下面哪些可以编译成功?

About multimap, which of the following can be compiled successfully?

答案是第一个,但我不知道为什么。谁能分析一下每一个?

第三个例子的问题是我们尝试插入的不是一对,这应该是对象 inserted.Correct 方法可以是:

multimap<string, double> mp2;
mp2.insert({"ok", 3.14});

第二个是错误的,因为键是 string 类型,而第三个参数,comparator,是 int.

第一个语法正确,编译成功,虽然比较奇怪