举例如下:
#include<cstdio> #include<iostream> #include<unordered_set> using namespace std; main(){ unordered_set<int> us; us.insert(1); us.insert(2); us.insert(3); cout<<us.count(6)<<endl; return 0; }
count函数只会返回1,0
对于count(x)
若us中存在x,返回1,反之,返回0
举例如下:
#include<cstdio> #include<iostream> #include<unordered_set> using namespace std; main(){ unordered_set<int> us; us.insert(1); us.insert(2); us.insert(3); cout<<us.count(6)<<endl; return 0; }
count函数只会返回1,0
对于count(x)
若us中存在x,返回1,反之,返回0