![]() |
|
#1
|
|||
|
|||
General Allocator for Several Data StructureHello to all expect C++ programmer,
I have code link list, double link list and binary search tree in C. Memory allocation and memory deallocation is take place for every new data structure i program. CPP / C++ / C Code:
Link List code : CPP / C++ / C Code:
As you can seen from here, this two program has its own memory allocation and memory deallocation. Therefore, i thought i going to reqrite BST in C++ but must have a general allocator for any data structure such as AVL tree, adjacency list and much more. I not intent to replace STL but just want to grasp some important concept and techniques of software reuse in C++. I hope you understand what i mentioned here. A billion thanks for your help. |
|||
|
#2
|
|||
|
|||
Re: General Allocator for Several Data StructureQuote:
For extra points, you will show greater mastery if you can emulate C++ templates in C. Your proposal above only stores integers within each node. Try to implement a mechanism which will allow any type to be stored within a node without resorting to void*. That's cheating. ![]() |
|
#3
|
|||
|
|||
Re: General Allocator for Several Data StructureMy intention to create a memory allocation and memory deallocate mechanism for some data structure. After achieved this, i will let the tree suitable for any data type.
I see no point for me to implement since C++ provide such facilities to us. Thanks for your help. |
|
#4
|
|||
|
|||
Re: General Allocator for Several Data StructurePlease help me.
|
Recent GIDBlog
Programming ebook direct download available by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Memory leak when nothing is happening... How can I even debug this ? | Algar | MS Visual C++ / MFC Forum | 10 | 19-Nov-2007 08:17 |
| [Include] Doubly-linked List | dsmith | C Programming Language | 6 | 14-Apr-2006 14:12 |
| Strange C++ code memory leakage problem | gaoanyu | C++ Forum | 7 | 04-Nov-2005 09:09 |
| [GIM] Data Module - Contact | dsmith | C Programming Language | 2 | 27-Jan-2005 17:30 |
| [CONTEST?]Data Structure Test | dsmith | C Programming Language | 2 | 06-Jun-2004 16:13 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The