Click here to Skip to main content
15,917,062 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How can I find style of CListCtrl ? Pin
Hans Dietrich3-May-11 7:47
mentorHans Dietrich3-May-11 7:47 
QuestionC# ASP.NET TreeView control Pin
RalfPeter2-May-11 12:57
RalfPeter2-May-11 12:57 
AnswerRe: C# ASP.NET TreeView control Pin
Hans Dietrich2-May-11 15:23
mentorHans Dietrich2-May-11 15:23 
GeneralRe: C# ASP.NET TreeView control Pin
RalfPeter3-May-11 3:47
RalfPeter3-May-11 3:47 
QuestionOutput characters into a file Pin
Francis Paran2-May-11 9:40
Francis Paran2-May-11 9:40 
AnswerRe: Output characters into a file Pin
Niklas L2-May-11 10:21
Niklas L2-May-11 10:21 
GeneralRe: Output characters into a file Pin
Francis Paran2-May-11 13:10
Francis Paran2-May-11 13:10 
Questionhow to make folder to file extension Pin
sarfaraznawaz2-May-11 2:43
sarfaraznawaz2-May-11 2:43 
AnswerRe: how to make folder to file extension Pin
David Crow2-May-11 2:59
David Crow2-May-11 2:59 
AnswerRe: how to make folder to file extension Pin
Niklas L2-May-11 5:23
Niklas L2-May-11 5:23 
AnswerRe: how to make folder to file extension Pin
Hans Dietrich2-May-11 6:02
mentorHans Dietrich2-May-11 6:02 
Questionimplementing multi linked list correctly_? Pin
quartaela1-May-11 23:52
quartaela1-May-11 23:52 
AnswerRe: implementing multi linked list correctly_? Pin
Stefan_Lang2-May-11 0:22
Stefan_Lang2-May-11 0:22 
GeneralRe: implementing multi linked list correctly_? Pin
quartaela2-May-11 0:28
quartaela2-May-11 0:28 
GeneralRe: implementing multi linked list correctly_? Pin
Stefan_Lang2-May-11 0:44
Stefan_Lang2-May-11 0:44 
Ah, that makes things difficult for me, as I'm not quite sure what is and is not quite possible C.

I'd say use three lists: one just for storing the nodes in an arbitrary order, and two to store your individual sortings, with nodes that only store the key you are using, plus a pointer to the appropriate node in your first list. In the case you describe you can define the node like this:
struct keynode {
   const char* key;
   struct NODE* node;
}

A more general version that could be used for other types of keys could be:
enum EKeytype { SKEY, IKEY, FKEY /*etc.*/ };
struct keynode {
   EKeytype keytype;
   union {
      const char* skey;
      int ikey;
      float fkey;
      // etc. ...
   } key;
   struct NODE* node;
}

In this case you need to check for the keytype to properly compare and sort the keys.

The disadvantage of using multiple lists is that youneed to add/remove multiple nodes. The advantage is that you can easily add more sorting criterias. And the code becomes cleaner, because you can seperate the storing from the sorting.
GeneralRe: implementing multi linked list correctly_? Pin
quartaela2-May-11 0:56
quartaela2-May-11 0:56 
GeneralRe: implementing multi linked list correctly_? Pin
Stefan_Lang2-May-11 2:44
Stefan_Lang2-May-11 2:44 
GeneralRe: implementing multi linked list correctly_? Pin
quartaela2-May-11 4:06
quartaela2-May-11 4:06 
GeneralRe: implementing multi linked list correctly_? Pin
Stefan_Lang2-May-11 4:44
Stefan_Lang2-May-11 4:44 
GeneralRe: implementing multi linked list correctly_? Pin
quartaela2-May-11 4:59
quartaela2-May-11 4:59 
GeneralRe: implementing multi linked list correctly_? Pin
Stefan_Lang2-May-11 6:20
Stefan_Lang2-May-11 6:20 
GeneralRe: implementing multi linked list correctly_? Pin
quartaela2-May-11 7:38
quartaela2-May-11 7:38 
AnswerRe: implementing multi linked list correctly_? Pin
David Crow2-May-11 9:13
David Crow2-May-11 9:13 
GeneralRe: implementing multi linked list correctly_? Pin
quartaela2-May-11 9:37
quartaela2-May-11 9:37 
QuestionHow does Google Chrome Installer gets installed with UAC Prompt Pin
Raj Aryan 10011-May-11 22:29
Raj Aryan 10011-May-11 22:29 

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.