|
-
June 22nd, 2007, 03:17 PM
#16
Re: Problem copying linked list (memory error)
From your description, I think there may be a need to refactor your code.
Since the child called a parent that called a child - etc. and you had to put in
a flag to prevent the infinite loop, this should be written in a way that
is not get into this situation.
BTW: Why did you create a list template when STL already has lists, queues,
etc. for you to use?
Note: Creating a small project that has the problem is a excellent way to
get help from CG. Everyone here can then download the problem code,
examine it, and debug it themselves. This is very helpful if the problem
isn't easy to find by examination.
-
June 25th, 2007, 09:13 AM
#17
Re: Problem copying linked list (memory error)
I wrote my own list class because I needed a few custom mutators which were not available in the STL. I also needed to add a few more pointers for each node, and thought it was the best way to do so.
The reason for the child calling the parent, etc, is that I wanted to have the parent running on a timer keeping track of the all the lists and then passing to the child only what it needs (since there are multiple children). That way, the child is responsible for only plotting the data it is given, and the parent is responsible for the manipulation of the data. It wouldn't work any other way really.
Thanks for your help though!
-
June 25th, 2007, 09:59 AM
#18
Re: Problem copying linked list (memory error)
 Originally Posted by Lucky75
I wrote my own list class because I needed a few custom mutators which were not available in the STL.
How did you come to that conclusion that it isn't available?
Please describe what you needed. It is hard to believe that what you wanted isn't available through using std::list and/or algorithms.
Regards,
Paul McKenzie
Last edited by Paul McKenzie; June 25th, 2007 at 10:02 AM.
-
June 25th, 2007, 01:20 PM
#19
Re: Problem copying linked list (memory error)
I was looking for a linked list capable of storing co-ordinates and with the option to make it double-linked and expand to hold more variables in the future. I also wanted to be able to add more mutators as I saw fit,which is something that is a little more difficult to do with STL class.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|