#include <iostream> #include <set> #include <vector> using namespace std;int main() {// 1. 默认构造函数set<int> emptySet; // 2. 初始化列表(自动去重和排序)set<int> numbers = {5, 2, 8, 1, 9, 3, 5, 2,1,1,1,1,1,2}; // {1, 2, 3, 5, 8, 9} // 3. 拷贝构造函数set<int> copySet(numbers); // 4. 范围构造函数vector<int> vec = {10, 20, 30, 20, 10};set<int> fromVector(vec.begin(), vec.end()); // {10, 20, 30} // 5. 指定比较函数的构造函数set<int, greater<int>> descendingSet = {5, 2, 8, 1, 9}; // {9, 8, 5, 2, 1}return 0; }