Click here to Skip to main content
15,891,033 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionInvalidating a rect Pin
RadPC29-Oct-06 23:55
RadPC29-Oct-06 23:55 
AnswerRe: Invalidating a rect Pin
Hamid_RT29-Oct-06 23:59
Hamid_RT29-Oct-06 23:59 
GeneralRe: Invalidating a rect Pin
RadPC30-Oct-06 0:14
RadPC30-Oct-06 0:14 
AnswerRe: Invalidating a rect Pin
Blake Miller30-Oct-06 4:02
Blake Miller30-Oct-06 4:02 
QuestionGet HBITMAP from JPEG/JPG Pin
QuickDeveloper29-Oct-06 23:25
QuickDeveloper29-Oct-06 23:25 
AnswerRe: Get HBITMAP from JPEG/JPG Pin
Hamid_RT29-Oct-06 23:56
Hamid_RT29-Oct-06 23:56 
Questionhow to access a COM component from ASP.net? Pin
voorugonda prashanth29-Oct-06 23:08
voorugonda prashanth29-Oct-06 23:08 
Questionsyntax in using for_each() on lists. Pin
minkowski29-Oct-06 22:46
minkowski29-Oct-06 22:46 
Hello

I am using the STL function for_each as outlined below
<br />
CheckAccount::~CheckAccount()<br />
{<br />
    for_each(translist.begin(), translist.end(), del_t);<br />
}<br />
<br />


and I understand the arguements as

translist.begin() = the 1st element of the list called translist
translist.end() = the last + 1 element of the list called translist
del_t = helper function and is defined as

<br />
<br />
inline void del_t(Transaction* tp){ delete tp; }<br />


in the same class.

My question is, why do you not use del_t() in the for_each loop. Since you are invoking a function I would have thought you need the (). I find that the above definition of the for_each loop works fine. But if I define it as

<br />
for_each(translist.begin(), translist.end(), del_t());<br />


I get an error. I have had a look on google and sometimes you use the () and sometimes you don't. Also I think that the 3rd argument of for_each (where there is del_t in this case) can be a class? But I dont understand why. Can you please provide me with an example of that?

Thank you for your time.
AnswerRe: syntax in using for_each() on lists. Pin
Niklas L29-Oct-06 23:02
Niklas L29-Oct-06 23:02 
QuestionGDI handles Pin
Waldermort29-Oct-06 22:24
Waldermort29-Oct-06 22:24 
AnswerRe: GDI handles Pin
Mark Salsbery30-Oct-06 5:37
Mark Salsbery30-Oct-06 5:37 
GeneralRe: GDI handles Pin
Waldermort30-Oct-06 6:47
Waldermort30-Oct-06 6:47 
QuestionCDialog in MDI Pin
baerten29-Oct-06 22:07
baerten29-Oct-06 22:07 
AnswerRe: CDialog in MDI Pin
Hamid_RT29-Oct-06 23:03
Hamid_RT29-Oct-06 23:03 
GeneralRe: CDialog in MDI Pin
baerten29-Oct-06 23:06
baerten29-Oct-06 23:06 
GeneralRe: CDialog in MDI Pin
Hamid_RT29-Oct-06 23:57
Hamid_RT29-Oct-06 23:57 
GeneralRe: CDialog in MDI [modified] Pin
baerten30-Oct-06 0:15
baerten30-Oct-06 0:15 
GeneralRe: CDialog in MDI Pin
David Crow30-Oct-06 3:22
David Crow30-Oct-06 3:22 
GeneralRe: CDialog in MDI Pin
Hamid_RT30-Oct-06 3:37
Hamid_RT30-Oct-06 3:37 
QuestionProblem with lib Pin
NorGUI29-Oct-06 22:01
NorGUI29-Oct-06 22:01 
AnswerRe: Problem with lib Pin
uusheikh29-Oct-06 22:17
uusheikh29-Oct-06 22:17 
GeneralRe: Problem with lib Pin
NorGUI29-Oct-06 22:38
NorGUI29-Oct-06 22:38 
GeneralRe: Problem with lib Pin
uusheikh29-Oct-06 22:55
uusheikh29-Oct-06 22:55 
GeneralRe: Problem with lib Pin
NorGUI30-Oct-06 1:45
NorGUI30-Oct-06 1:45 
Questionfilelistbox in vc++ Pin
zareee29-Oct-06 21:49
zareee29-Oct-06 21:49 

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.