Click here to Skip to main content
16,010,268 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to sort a CArray with minimum effort Pin
jhwurmbach16-Sep-08 1:20
jhwurmbach16-Sep-08 1:20 
AnswerRe: How to sort a CArray with minimum effort - Cured! Pin
Iain Clarke, Warrior Programmer16-Sep-08 1:51
Iain Clarke, Warrior Programmer16-Sep-08 1:51 
GeneralRe: How to sort a CArray with minimum effort - Cured! Pin
jhwurmbach16-Sep-08 1:54
jhwurmbach16-Sep-08 1:54 
AnswerRe: How to sort a CArray with minimum effort Pin
Cedric Moonen16-Sep-08 1:05
Cedric Moonen16-Sep-08 1:05 
GeneralRe: How to sort a CArray with minimum effort Pin
Iain Clarke, Warrior Programmer16-Sep-08 1:20
Iain Clarke, Warrior Programmer16-Sep-08 1:20 
AnswerRe: How to sort a CArray with minimum effort Pin
Sarath C16-Sep-08 1:08
Sarath C16-Sep-08 1:08 
GeneralRe: How to sort a CArray with minimum effort Pin
Iain Clarke, Warrior Programmer16-Sep-08 1:22
Iain Clarke, Warrior Programmer16-Sep-08 1:22 
AnswerRe: How to sort a CArray with minimum effort Pin
Matthew Faithfull16-Sep-08 2:01
Matthew Faithfull16-Sep-08 2:01 
The 'cheat' I generally use for this is a bit of a zen solution. I don't sort the array at all Smile | :)
Instead I keep a parallel array of simple unsigned integers and I sort that and use it as an index into my array of complex objects. I use the standard sort algorithums but my comparator functions, instead of just comparing integers uses them to look up the real array and returns a comparison result dependent on what it finds there.
If you dig around in the source of my constructional patterns article [^] you'll find an indexed list class, possibly even templated so you use it with your data structures.

"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)

GeneralRe: How to sort a CArray with minimum effort Pin
Iain Clarke, Warrior Programmer16-Sep-08 2:13
Iain Clarke, Warrior Programmer16-Sep-08 2:13 
GeneralRe: How to sort a CArray with minimum effort Pin
Matthew Faithfull16-Sep-08 2:26
Matthew Faithfull16-Sep-08 2:26 
JokeRe: How to sort a CArray with minimum effort Pin
CPallini16-Sep-08 2:54
mveCPallini16-Sep-08 2:54 
GeneralRe: How to sort a CArray with minimum effort Pin
Iain Clarke, Warrior Programmer16-Sep-08 3:02
Iain Clarke, Warrior Programmer16-Sep-08 3:02 
AnswerRe: How to sort a CArray with minimum effort Pin
Joe Woodbury17-Sep-08 10:56
professionalJoe Woodbury17-Sep-08 10:56 
QuestionCan anyone see memory leak in this code? Pin
SRKSHOME16-Sep-08 0:42
SRKSHOME16-Sep-08 0:42 
AnswerRe: Can anyone see memory leak in this code? Pin
Matthew Faithfull16-Sep-08 2:03
Matthew Faithfull16-Sep-08 2:03 
GeneralRe: Can anyone see memory leak in this code? Pin
SRKSHOME16-Sep-08 2:45
SRKSHOME16-Sep-08 2:45 
GeneralRe: Can anyone see memory leak in this code? Pin
Iain Clarke, Warrior Programmer16-Sep-08 3:08
Iain Clarke, Warrior Programmer16-Sep-08 3:08 
GeneralRe: Can anyone see memory leak in this code? Pin
SRKSHOME16-Sep-08 19:17
SRKSHOME16-Sep-08 19:17 
GeneralRe: Can anyone see memory leak in this code? Pin
Iain Clarke, Warrior Programmer16-Sep-08 21:41
Iain Clarke, Warrior Programmer16-Sep-08 21:41 
GeneralRe: Can anyone see memory leak in this code? Pin
SRKSHOME17-Sep-08 2:51
SRKSHOME17-Sep-08 2:51 
GeneralRe: Can anyone see memory leak in this code? Pin
Matthew Faithfull16-Sep-08 3:20
Matthew Faithfull16-Sep-08 3:20 
GeneralRe: Can anyone see memory leak in this code? Pin
SRKSHOME16-Sep-08 19:20
SRKSHOME16-Sep-08 19:20 
QuestionDevice name from the devicemanager Pin
hariakuthota15-Sep-08 23:50
hariakuthota15-Sep-08 23:50 
QuestionRe: Device name from the devicemanager [modified] Pin
Roger Stoltz16-Sep-08 0:02
Roger Stoltz16-Sep-08 0:02 
AnswerRe: Device name from the devicemanager Pin
cmk16-Sep-08 9:34
cmk16-Sep-08 9:34 

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.