Map is a type of associative container. It is characterized by the small effect of adding and removing nodes on iterators, except for the Operation node, which has no effect on other nodes.
For iterators, you can modify the real value without modifying the key.
#include <map>using namespaceStd;map<int,vector<byte>>Mapdatas;voidCmfcapplication2dlg::onbnclickedbutton1 () {//TODO: Add control notification handler code hereVector<byte>vtemp; for(inti =0; I <4; i++) {vtemp.clear (); Vtemp.push_back ((byte) (i); Vtemp.push_back ((byte) (i+1)); Mapdatas.insert (Map<int, vector<byte>>:: Value_type (I, vtemp)); } Map<int, vector<byte>>:: Iterator iter; for(iter = Mapdatas.begin (); ITER! = Mapdatas.end (); iter++) { intKey = Iter->First ; Vector<byte> value = iter->second; OutputDebugString (_t ("\ r \ n")); for(inti =0; I < value.size (); i++) {CString str; Str. Format (_t ("0x%02X"), Value[i]); OutputDebugString (str+" "); } }}
C + + Map