std::set in C++ — a practical guide to C++ std::set with clear examples you can reuse in real projects.
C++ Tutorial Series (88/111). Prefer one article? Read the complete C++ tutorial.
Short description
Lookups/inserts are typically logarithmic.
set
#include <set>
std::set<int> s = {3, 1, 2};
s.insert(2); // still one 2