Created
June 26, 2012 06:34
-
-
Save ashwin/2993790 to your computer and use it in GitHub Desktop.
Using unordered_set
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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