/** =====================================================================================** Filename: Map.cpp** Description:** Version: 1.0* Created: 2017年03月01日 16时17分47秒* Last Modified: 2018年01月13日 13:38:36* Revision: none* Compiler: gcc** Author: zt (),* Organization:** =====================================================================================*/#include <iostream>#include <map>int main ( int argc, char* argv[] ){( void ) argc;( void ) argv;std::multimap<char, int> mymm;mymm.insert ( std::pair<char, int> ( 'x', 10 ) );mymm.insert ( std::pair<char, int> ( 'y', 20 ) );mymm.insert ( std::pair<char, int> ( 'z', 30 ) );mymm.insert ( std::pair<char, int> ( 'a', 20 ) );mymm.insert ( std::pair<char, int> ( 'b', 20 ) );mymm.insert ( std::pair<char, int> ( 'z', 33 ) );mymm.insert ( std::pair<char, int> ( 't', 50 ) );mymm.insert ( std::pair<char, int> ( 'z', 40 ) );auto iter = mymm.begin();for ( ; iter != mymm.end(); ){if ( iter->second == 20 )mymm.erase ( iter++ );elseiter++;}for ( auto& e : mymm )std::cout << e.first << " " << e.second << std::endl;//std::multimap<char, int>::iterator it = mymm.find ( 'z' );//do//{//std::cout << it->first << " " << it->second << std::endl;//++it;//}//while ( it != mymm.end() );return 0;}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。