Skip to content

Instantly share code, notes, and snippets.

@ashwin
Created June 26, 2012 06:34
Show Gist options
  • Save ashwin/2993790 to your computer and use it in GitHub Desktop.
Save ashwin/2993790 to your computer and use it in GitHub Desktop.
Using unordered_set
#include <iostream>
#include <unordered_set>
typedef std::unordered_set< int > IntUSet;
int main()
{
IntUSet iset;
// Insert
iset.insert( 10 );
iset.insert( 99 );
iset.insert( 1000 );
// Find
if ( iset.end() == iset.find( 99 ) )
std::cout << "Not found\n";
else
std::cout << "Found\n";
// Remove
iset.erase( 10 );
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment