I'd like to use unordered_set
in a project.
However, documentation for it is either incomplete or just a technical reference, no examples.
Can anyone provide links to online resources which deal with it? Books also welcome, preferably free. Google searching returned nothing of value.
Thanks!
Code for the most common use case:
#include <boost/unordered_set.hpp>
using boost::unordered_set;
using std::string;
using std::cout;
using std::endl;
int main (void)
{
// Initialize set
unordered_set<string> s;
s.insert("red");
s.insert("green");
s.insert("blue");
// Search for membership
if(s.find("red") != s.end())
cout << "found red" << endl;
if(s.find("purple") != s.end())
cout << "found purple" << endl;
if(s.find("blue") != s.end())
cout << "found blue" << endl;
return 0;
}
Output
found red
found blue
More Information
http://www.cplusplus.com/reference/unordered_set/unordered_set/find/