When I am using map.contains()
in my C++ code using Visual Studio Code I get the following message:
class "std::map<int, int, std::less, std::allocator<std::pair<const int, int>>>" has no member "contains"
Thankfully, my code compiles when I run g++ -std=c++20 test.cc -o test
, but VSCode keeps telling me there's a problem, which is quite irritating. This is my code:
#include <map>
using namespace std;
map<int, int> m;
bool contains_key(int idx) { return m.contains(idx); }
Has anyone had the same issue and knows how to fix it?