CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19
  1. #16
    Join Date
    Aug 2001
    Location
    Texas
    Posts
    645

    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.

  2. #17
    Join Date
    Apr 2007
    Posts
    87

    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!

  3. #18
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Problem copying linked list (memory error)

    Quote 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.

  4. #19
    Join Date
    Apr 2007
    Posts
    87

    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.

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured