CLinkedList- double linked list list class

Environment: Visual Studio, all Windows platforms

Over time, all programmers, engineers, and other code writers have accepted and fully understood some of the abstract data types in the C/C++ coding world. Some people prefer to use their own abstract data types, while others prefer to use existing algorithms provided by the standard Template Library (STL) or elsewhere. My own code lists have evolved over time, and I believe this particular set of double-linked list code should provide most of the full functionality that any developer needs.

Before C++ came along (yes, that shows how old I am), this source code started with its early “C “language version, followed by the STL and its associated container classes, templates, algorithms, and so on. Therefore, the CLinkedList class is very stable, and if you think STL is sufficient, continue to use STL. However, if your product needs better performance, or if you need a solution on top of a legacy product, the CLinkedList class is definitely worth a look because it has almost no processing overhead compared to the number of STL function calls for the same function.

For those STL users reading this document, I wrote these examples with class and template usage out of the top of my mind, so I used a lot of casts to return data. I apologize to these users/readers for this. My goal is to demonstrate functionality, not style or other programming habits. In addition, if you compile the project, the output should be readable.

The source code is basically completely annotated. There is also an HTML version of the help file, which includes a lot of sample code.

The following is a list of member functions of the CLinkedList class. Have fun coding!

Constructor(...) Constructor int dladd(void* data) adds nodes to list int dladdins(void* data) adds nodes using insert sort. Long dlcount(void) returns the number of nodes in the list int Dlclear (void) Delete all nodes int dldelete(void) Delete the current node void* dlfind(void* data) Obtain a copy of the current node by looking for the node void* dlget(void) Void * dlgoback(void) traverses backwards void* dlgofwd(void) traverses forwards int dlinsert(void* data) inserts the node at the current point int dlmark(void) marks the node long Dlposn (void) returns node position int dlqsort(void) uses qsort() to sort the whole list int dlreplace(void* data) replaces the current node with the supplied data int dlrewind( Bool dlsort(void) Uses the original swap algorithm to sort lists. Bool dlsorted(void) If the list is in order, Returns true/false void* dltoFirst (void) jumps to the first node void* dltolast(void) jumps to the last node int dltomark(void) jumps to the last marked node int Dlunmark (void) unmark a previous node int DumpMemory() outputs the contents of some memory int dlDumplist (void) outputs the contents of the entire list int dlDumplist (void) outputs the contents of the entire list Void * operator[](long) Queue access operator void* operator++(int) equivalent to dlgofwd() Void * operator--(int) equivalent to dlgoback()Copy the code

Download resources

  • Download the demo
  • Download the source code
  • Download HTML documents