C/C++ 开发人员的 Eclipse IDE:错误显示 "invalid arguments" 错误?

Eclipse IDE for C/C++ Developers: "invalid arguments" error displayed by mistake?

我在 map_name.insert(make_pair("string_name", int_name);.

C/C++ Developers Photon (4.8.0) 的 Eclipse IDE 中收到无效参数错误

我正在使用 GCC 8.2.0。我正在尝试使用 STL 做一些简单的事情。

尝试了 insert(make_pair())insert(pair<string, int>()) 得到相同的 IDE 错误(语义错误)。这是为什么?

代码:

#include <iostream>
#include <map>
using namespace std;

int main()
{
    map<string, int> ages;

    ages["Mike"] = 21;
    ages["Johnny"] = 20;
    ages["Vicky"] = 30;
    ages["Mike"] = 42;

//  ages.insert(make_pair("Peter", 100));
    ages.insert(pair < string, int > ("Peter", 100));

    for(map<string, int>::iterator it = ages.begin(); it!=ages.end(); it++)
    {
        cout<< it->first<<": "<< it->second<<endl;

    }

     return (0);
}

这是 IDE 中显示的错误:

GCC 8 附带的标准库实现使用称为 __is_constructible 的类型特征内在特性,Eclipse CDT 的解析器尚不支持。

当 CDT 解析 GCC 8 的标准库代码时,这可能会导致误报错误。

如果您使用 GCC 7 或更早版本,则此代码不会出现任何错误。

更新This eclipse bug tracks 将对 __is_constructible 的支持添加到 CDT 的解析器。它最近已得到修复,尽管该修复程序尚未出现在 CDT 版本中。