//set底层是红黑树,有序。unordered_set底层是哈希,无须,但查找效率高,速度快 #include <iostream> #include <set> using namespace std; int main() { set<int>s; s.insert(2); s.insert(4); for(auto x:s) cout<<x<<endl; return 0; }
容器set
原文:https://www.cnblogs.com/zmachine/p/12289875.html