CPP/C++0x/UnorderedSet
From ProgrammingExamples
UnorderedSet.cpp
#include <iostream> #include <unordered_set> // must use -std=c++0x flag int main(int argc, char* argv[]) { // Create a set std::unordered_set<unsigned int> S; // Add 10 elements to the set for(unsigned int i = 0; i < 10; i++) { S.insert(i); } // Output all of the elements in the set for(auto it1 = S.cbegin(); it1 != S.cend(); it1++) { std::cout << " " << *it1; } return 0; }
CMakeLists.txt
cmake_minimum_required(VERSION 2.6) Project(UnorderedSet) ADD_EXECUTABLE(UnorderedSet UnorderedSet.cpp)