Home > Back-end >  Consult about sorting problem in multimap in C
Consult about sorting problem in multimap in C

Time:09-24

Excuse me multimap of c + + with the same key pair of elements is continuous arrangement?
This code directly iterator + + can point to a second key words in the same position,
Multimap of memory is continuous, but if the element of storage is out-of-order, also can be directly so iterative + + access to the second element of the same keywords? This is the default, why?
 typedef multimap : : size_type sz_type; 
Sz_type entries=multimapSTRint. Count (" strtrest ");//find the number of element
Multimap : : iterator iter=multimapSTRint. Find (" strtrest ");
For (sz_type CNT=0; CNT!=entries; CNT + +, + + iter)
{
Int strtest;
Strtest=iter - & gt; Second;
}


A newcomer just learning c + +, reading a book to see a little fast, perhaps there are omissions, also hope to teach!

CodePudding user response:

I searched the information found an associative container features: according to the keywords in order to save the element
Want to confirm, he means, associated container, regardless of what elements to add sequence is stored when will have the same key words are put together, and then followed by a group of elements of the same keywords, between elements of the same keyword as before and after the added order?
  • Related