c++map反復器 1009 ワード #include #include using namespace std; int main(){ map mp; for (int i = 0; i < 10; i ++){ mp[i] = i; } //count if (mp.count(0)) { printf("yes"); } else { printf("no"); } //find map::iterator it_find=mp.begin(); it_find = mp.find(9); if(it_find != mp.end()) { it_find->second = 20; } else { printf("nno"); } //erase //mp.erase(it_find); mp.insert(map::value_type(100,100)); //traversal map::iterator it; for (it = mp.begin(); it != mp.end(); it++){ printf("%d-->%d", it->first, it->second); } return 0; } 転載先:https://www.cnblogs.com/muahao/p/8808376.html Twitterでリプライが飛んで来たらすぐにいいねする PoCoログにタイムスタンプ