C++STLのカスタムソート 1400 ワード C++ (1)構造体を用いてoperator()関数を書き換える#include #include #include #include using std::map; using std::vector; using std::max; using std::cin; using std::cout; using std::endl; struct Comp { bool operator()(const int &a,const int &b) { if(a>b) return true; else return false; } }; int main() { int N,M,a; map,Comp> mp; cin>>N>>M; for(int i=0;i>a; mp[i].push_back(a); } } for(auto&& w:mp) { cout< (2)Lambda式の使用#include #include #include using std::map; using std::vector; using std::max; using std::cin; using std::cout; using std::endl; int main() { int N,M,a; auto comp = [&](const int &a, const int &b) { if(a>b) return true; else return false; }; map,decltype(comp)> mp(comp); cin>>N>>M; for(int i=0;i>a; mp[i].push_back(a); } } for(auto&& w:mp) { cout< 【Mac】Gitバージョンアップ centosバイナリインストールdockerおよびdocker-compose