Click here to Skip to main content
15,914,500 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: Uisng ATL7 CMimeMessage classes Pin
Amit Dey28-Mar-03 18:53
Amit Dey28-Mar-03 18:53 
GeneralRe: Uisng ATL7 CMimeMessage classes Pin
geo_m28-Mar-03 22:04
geo_m28-Mar-03 22:04 
GeneralRe: Using ATL7 CMimeMessage classes Pin
Amit Dey29-Mar-03 21:37
Amit Dey29-Mar-03 21:37 
GeneralRe: Using ATL7 CMimeMessage classes Pin
Amit Dey29-Mar-03 21:39
Amit Dey29-Mar-03 21:39 
GeneralRe: Using ATL7 CMimeMessage classes Pin
geo_m29-Mar-03 22:49
geo_m29-Mar-03 22:49 
GeneralRe: Using ATL7 CMimeMessage classes Pin
Amit Dey30-Mar-03 8:47
Amit Dey30-Mar-03 8:47 
Generalcopy multimap to vector Pin
Anonymous26-Mar-03 9:07
Anonymous26-Mar-03 9:07 
GeneralRe: copy multimap to vector Pin
jbarton26-Mar-03 9:48
jbarton26-Mar-03 9:48 
If you use the copy algorithm, the vector needs to contain the same data as the multimap. This means that the vector has to contain pair data if you use copy.

So, the following works:

<br />
   multimap<int,int> myMap;<br />
<br />
   myMap.insert( pair<int,int>(1,11) );<br />
   myMap.insert( pair<int,int>(1,12) );<br />
   myMap.insert( pair<int,int>(2,21) );<br />
   myMap.insert( pair<int,int>(2,22) );<br />
   myMap.insert( pair<int,int>(2,23) );<br />
<br />
   multimap<int,int>::iterator startRange = myMap.lower_bound(2);<br />
   multimap<int,int>::iterator endRange = myMap.upper_bound(2);<br />
<br />
   vector< pair<int,int> > myVector;<br />
<br />
   copy( startRange, endRange, back_inserter(myVector) );<br />



If you want the vector to contain just the second element, you need to use some algorithm other than copy. One way to do this is to use the transform algorithm.

The following is one way to do this:

<br />
// declare functor to get the second value from the pair<br />
struct copysecond<br />
   {<br />
   int operator()( const pair<int,int>& value )<br />
      {<br />
      return value.second;<br />
      }<br />
   };<br />
<br />
<br />
<br />
<br />
   // assume that the multimap is setup as above...<br />
   vector<int> myVector;<br />
<br />
   transform( startRange, endRange, back_inserter(myVector), copysecond() );<br />

GeneralRe: copy multimap to vector Pin
Tim Smith26-Mar-03 10:00
Tim Smith26-Mar-03 10:00 
GeneralRe: copy multimap to vector Pin
jbarton26-Mar-03 10:04
jbarton26-Mar-03 10:04 
GeneralHosting a modeless dialog as a control (WTL) Pin
yarp26-Mar-03 4:26
yarp26-Mar-03 4:26 
GeneralRe: Hosting a modeless dialog as a control (WTL) Pin
yarp26-Mar-03 4:29
yarp26-Mar-03 4:29 
GeneralRe: Hosting a modeless dialog as a control (WTL) Pin
Michael Dunn26-Mar-03 17:56
sitebuilderMichael Dunn26-Mar-03 17:56 
GeneralRe: Hosting a modeless dialog as a control (WTL) Pin
yarp26-Mar-03 20:20
yarp26-Mar-03 20:20 
GeneralSTL Pin
tsb26-Mar-03 4:26
tsb26-Mar-03 4:26 
GeneralRe: STL Pin
valikac26-Mar-03 11:45
valikac26-Mar-03 11:45 
GeneralRe: STL Pin
geo_m27-Mar-03 0:12
geo_m27-Mar-03 0:12 
GeneralSTL fstream format question Pin
Nitron25-Mar-03 11:31
Nitron25-Mar-03 11:31 
GeneralRe: STL fstream format question Pin
Nemanja Trifunovic25-Mar-03 11:42
Nemanja Trifunovic25-Mar-03 11:42 
GeneralRe: STL fstream format question Pin
Nitron25-Mar-03 11:43
Nitron25-Mar-03 11:43 
GeneralRe: STL fstream format question Pin
Nemanja Trifunovic25-Mar-03 11:52
Nemanja Trifunovic25-Mar-03 11:52 
GeneralRe: STL fstream format question Pin
Nitron25-Mar-03 13:23
Nitron25-Mar-03 13:23 
General_bstr_t problem Pin
particle2k25-Mar-03 6:32
particle2k25-Mar-03 6:32 
GeneralRe: _bstr_t problem Pin
particle2k25-Mar-03 6:39
particle2k25-Mar-03 6:39 
GeneralRe: _bstr_t problem Pin
geo_m25-Mar-03 10:16
geo_m25-Mar-03 10:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.