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

C / C++ / MFC

 
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 
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 
You can either use the general sort algorithm (std::sort) or write a specialized less<MyData>() functor that looks something like:


struct std::less<MyData>
{
	bool operator()(const MyData& lhs, const MyData& rhs)
	{
		return lhs.m_iData < rhs.m_iData;
	}
};


And then call mylist.sort(std::less<MyData>).

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 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 
QuestionRTI - related (Zac Howland) can help [modified] Pin
Jay0310-Jul-06 4:43
Jay0310-Jul-06 4:43 
AnswerRe: RTI - related (Zac Howland) can help Pin
Zac Howland10-Jul-06 5:01
Zac Howland10-Jul-06 5:01 

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.