Click here to Skip to main content
16,011,988 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralCEdit's ballon notification (ES_NUMBER) Pin
J.B.23-Jun-04 19:13
J.B.23-Jun-04 19:13 
GeneralC++ computational efficiency Pin
Indrawati23-Jun-04 18:54
Indrawati23-Jun-04 18:54 
GeneralRe: C++ computational efficiency Pin
Paul Ranson24-Jun-04 10:32
Paul Ranson24-Jun-04 10:32 
QuestionHow to list all the Folder that Shared fully in a Drive Pin
ngocdq23-Jun-04 15:16
ngocdq23-Jun-04 15:16 
AnswerRe: How to list all the Folder that Shared fully in a Drive Pin
Yogesh Kshatriya23-Jun-04 18:20
Yogesh Kshatriya23-Jun-04 18:20 
GeneralRe: How to list all the Folder that Shared fully in a Drive Pin
ngocdq24-Jun-04 15:44
ngocdq24-Jun-04 15:44 
GeneralSimple STL question - using STL algorithm on STL map Pin
Indrawati23-Jun-04 14:25
Indrawati23-Jun-04 14:25 
GeneralRe: Simple STL question - using STL algorithm on STL map Pin
Michael Dunn23-Jun-04 15:11
sitebuilderMichael Dunn23-Jun-04 15:11 
The parameter of the for_each predicate is the result of dereferencing an iterator, which in the case of a map is a map<key,value>::value_type, or pair<const key,value>. So the predicate can look at the second member of the pair:
#include <map>
#include <algorithm>
typedef map<char,int> mymap; 
 
struct TotalIt
{
    void operator()( mymap::value_type elt ) // same as "pair<const char,int> elt"
    {
        m_total += elt.second;
    }
 
    int m_total;
    TotalIt() : m_total(0) { }
};
 
int main()
{
mymap M;
 
    M['a'] = 1;
    M['b'] = 2;
    M['c'] = 3;
    M['d'] = 4;
    M['e'] = 5;
    
    for_each ( M.begin(), M.end(), TotalIt() );
}


--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ

----
If my rhyme was a drug, I'd sell it by the gram.
GeneralRe: Simple STL question - using STL algorithm on STL map Pin
Paul Ranson24-Jun-04 6:00
Paul Ranson24-Jun-04 6:00 
Generalappend data to file Pin
elephantstar23-Jun-04 14:00
elephantstar23-Jun-04 14:00 
GeneralRe: append data to file Pin
Michael Dunn23-Jun-04 14:57
sitebuilderMichael Dunn23-Jun-04 14:57 
GeneralRe: append data to file Pin
normanS23-Jun-04 21:02
normanS23-Jun-04 21:02 
GeneralRe: append data to file Pin
Michael Dunn24-Jun-04 6:57
sitebuilderMichael Dunn24-Jun-04 6:57 
GeneralRe: append data to file Pin
elephantstar24-Jun-04 6:56
elephantstar24-Jun-04 6:56 
GeneralDFS Lookups Pin
Anonymous23-Jun-04 13:45
Anonymous23-Jun-04 13:45 
GeneralRe: DFS Lookups Pin
NullStream23-Jun-04 13:47
NullStream23-Jun-04 13:47 
Generaleditable listctrl Pin
DanYELL23-Jun-04 13:08
DanYELL23-Jun-04 13:08 
GeneralRe: editable listctrl Pin
Anthony_Yio23-Jun-04 16:44
Anthony_Yio23-Jun-04 16:44 
QuestionA better System( ... ) call? Pin
mike-o23-Jun-04 12:37
mike-o23-Jun-04 12:37 
AnswerRe: A better System( ... ) call? Pin
Johan Rosengren23-Jun-04 21:32
Johan Rosengren23-Jun-04 21:32 
GeneralRe: A better System( ... ) call? Pin
mike-o24-Jun-04 5:29
mike-o24-Jun-04 5:29 
GeneralInterpreting strings as packed binary data Pin
NizZy23-Jun-04 12:18
NizZy23-Jun-04 12:18 
GeneralRe: Interpreting strings as packed binary data Pin
NizZy23-Jun-04 12:28
NizZy23-Jun-04 12:28 
Generalnamed pipe problem Pin
pnpfriend23-Jun-04 11:20
pnpfriend23-Jun-04 11:20 
GeneralNeed Map to Database Ideas Pin
macbeth7623-Jun-04 10:20
macbeth7623-Jun-04 10:20 

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.