Renewed Structure

This commit is contained in:
e2hang
2025-08-28 21:17:28 +08:00
parent b97f348a51
commit 1a5c4329b2
163 changed files with 312 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
#include <iostream>
#include <string>
#include <map>
using namespace std;
int main(int argc, char* argv[]){
auto cmp = [](auto a, auto b){
return a < b;
};
//<2F><>set<65><74><EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>std::pair<69><72><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD>صģ<D8B5><C4A3>ǵ<EFBFBD>дfirst,second
map<int, string> a;
map<int, string, decltype(cmp)> b(cmp);
map<int, string> c;
b.insert({1,"111"});
b.insert({2,"222"});
b.insert({5,"555"});
b.insert(make_pair(3,"333"));
b.emplace(make_pair(4,"444"));
cout << b.count(3) << endl;
//û<><C3BB>.at()<29><>a[i]<5D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD>ӷ<EFBFBD><D3B7>ʵ<EFBFBD>i<EFBFBD><69><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>it++
for(auto it = b.begin(); it != b.end(); it++){
cout << it->first << ", " << it->second << " ";
}
cout << endl;
cout << b.find(3)->first << ", "<< b.find(3)->second << endl;
cout << b.upper_bound(4)->first << ", " << b.upper_bound(4)->second << endl;
return 0;
}
/*
1
1, 111 2, 222 3, 333 4, 444 5, 555
3, 333
5, 555
*/