Click here to Skip to main content
15,902,811 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Sorting a list with class for complex types Pin
David Crow10-Jul-06 7:36
David Crow10-Jul-06 7:36 
AnswerRe: Sorting a list with class for complex types [modified] Pin
Harold_Wishes10-Jul-06 7:48
Harold_Wishes10-Jul-06 7:48 
GeneralRe: Sorting a list with class for complex types [modified] Pin
FarPointer10-Jul-06 7:54
FarPointer10-Jul-06 7:54 
GeneralRe: Sorting a list with class for complex types [modified] Pin
Harold_Wishes10-Jul-06 8:09
Harold_Wishes10-Jul-06 8:09 
GeneralRe: Sorting a list with class for complex types Pin
FarPointer10-Jul-06 8:18
FarPointer10-Jul-06 8:18 
GeneralRe: Sorting a list with class for complex types Pin
Harold_Wishes10-Jul-06 8:33
Harold_Wishes10-Jul-06 8:33 
GeneralRe: Sorting a list with class for complex types Pin
David Crow10-Jul-06 9:11
David Crow10-Jul-06 9:11 
GeneralRe: Sorting a list with class for complex types Pin
Zac Howland10-Jul-06 8:39
Zac Howland10-Jul-06 8:39 
Harold_Wishes wrote:
// Dump the list to check the result
for (list::const_iterator citer = mylist.begin();
citer != mylist.end(); ++citer)
{
cout << (*citer).m_iData << endl;
}


Don't write your own loop for this.

// declared somewhere
void printData(const MyData& data)
{
	cout << data.m_iData << endl;
}

// use instead of loop
for_each(myList.begin(), myList.end(), printData);




If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week

Zac
GeneralRe: Sorting a list with class for complex types [modified] Pin
Harold_Wishes10-Jul-06 9:01
Harold_Wishes10-Jul-06 9:01 
GeneralRe: Sorting a list with class for complex types Pin
Zac Howland10-Jul-06 9:25
Zac Howland10-Jul-06 9:25 
GeneralRe: Sorting a list with class for complex types Pin
David Crow10-Jul-06 8:18
David Crow10-Jul-06 8:18 
GeneralRe: Sorting a list with class for complex types Pin
FarPointer10-Jul-06 8:26
FarPointer10-Jul-06 8:26 
GeneralRe: Sorting a list with class for complex types Pin
David Crow10-Jul-06 8:39
David Crow10-Jul-06 8:39 
GeneralRe: Sorting a list with class for complex types [modified] Pin
Harold_Wishes10-Jul-06 7:35
Harold_Wishes10-Jul-06 7:35 
GeneralRe: Sorting a list with class for complex types Pin
FarPointer10-Jul-06 7:44
FarPointer10-Jul-06 7:44 
AnswerRe: Sorting a list with class for complex types Pin
earl10-Jul-06 9:29
earl10-Jul-06 9:29 
GeneralRe: Sorting a list with class for complex types Pin
Harold_Wishes10-Jul-06 10:49
Harold_Wishes10-Jul-06 10:49 
GeneralRe: Sorting a list with class for complex types Pin
earl10-Jul-06 11:14
earl10-Jul-06 11:14 
GeneralRe: Sorting a list with class for complex types [modified] Pin
Harold_Wishes10-Jul-06 15:07
Harold_Wishes10-Jul-06 15:07 
GeneralRe: Sorting a list with class for complex types Pin
earl11-Jul-06 4:27
earl11-Jul-06 4:27 
AnswerRe: Sorting a list with class for complex types [modified] Pin
Stephen Hewitt10-Jul-06 14:45
Stephen Hewitt10-Jul-06 14:45 
GeneralRe: Sorting a list with class for complex types Pin
Harold_Wishes10-Jul-06 15:00
Harold_Wishes10-Jul-06 15:00 
GeneralRe: Sorting a list with class for complex types Pin
Stephen Hewitt10-Jul-06 15:05
Stephen Hewitt10-Jul-06 15:05 
GeneralRe: Sorting a list with class for complex types [modified] Pin
Harold_Wishes10-Jul-06 22:38
Harold_Wishes10-Jul-06 22:38 
GeneralRe: Sorting a list with class for complex types Pin
Stephen Hewitt11-Jul-06 1:06
Stephen Hewitt11-Jul-06 1:06 

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.