| <<< std::multimap | Index | STL Algorithms >>> |
equal_range( key ) returns a range that includes all elements for a given key:
typedef multimap< string, int > MMapT;
typedef MMapT::const_iterator MMIterT;
MMapT amap;
pair< MMIterT, MMIterT > result = amap.equal_range( "Fred" );
// Print out all values for the key named "Fred"
for( MMIterT mit = result.first; mit != result.second; mit++ ) {
cout
<< mit->first
<< " "
<< mit->second
<< endl
;
}
| <<< std::multimap | Index | STL Algorithms >>> |