unordered_set的用法
#include <iostream>
#include <boost/unordered_set.hpp>
#include <hash_set>
#include <boost/assign.hpp>
using namespace std;
using namespace boost;
template <typename T>
void hash_func()
{
using namespace boost::assign;
T s = (list_of(1),2,3,4,5);
for (T::iterator p = s.begin(); p != s.end(); ++p)
{
cout << *p << endl;
}
cout << "长度:" << s.size() << endl;
s.clear();
cout << "是否为空:" << s.empty() << endl;
s.insert(8);
s.insert(45);
cout << "现在的长度为:" << s.size() << endl;
cout << *s.find(8) << endl;
s.erase(45);
}
int main()
{
hash_func<hash_set<int>>();
hash_func<unordered_set<int>>();
return 0;
}