CPP/STL/Set
From ProgrammingExamples
Set.cpp
#include <iostream> #include <set> #include <vector> #include <cstdlib> #include <algorithm> int main(int argc, char* argv[]) { // Create a set std::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(std::set<unsigned int>::iterator it1 = S.begin(); it1 != S.end(); it1++) { std::cout << " " << *it1; } std::cout << "Size: " << S.size() << " Empty? " << S.empty() << std::endl; return 0; }
CMakeLists.txt
cmake_minimum_required(VERSION 2.6) Project(Set) ADD_EXECUTABLE(Set Set.cpp)