当我map.contains()使用 Visual Studio Code 在 C++ 代码中使用时,我收到以下消息:
类“std::map<int, int, std::less, std::allocator<std::pair<const int, int>>>”没有成员“包含”
值得庆幸的是,我的代码在运行时可以编译g++ -std=c++20 test.cc -o test,但 VSCode 一直告诉我有问题,这很烦人。这是我的代码:
#include <map>
using namespace std;
map<int, int> m;
bool contains_key(int idx) { return m.contains(idx); }
Run Code Online (Sandbox Code Playgroud)
有没有人遇到过同样的问题并且知道如何解决它?