Passing a Struct type that's within a class

About Monkey 2 Forums Monkey 2 Programming Help Passing a Struct type that's within a class

This topic contains 2 replies, has 2 voices, and was last updated by  peterigz 2 years, 10 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1035

    peterigz
    Participant

    I was just trying to modify the way I remove things from a list due to the “Concurrent list modification” error you get now which is fine. What I had was a method that removed the item like this:

    [/crayon]

    Now I’d like to remove using the “Erase” method in the Iterator Struct but how do I pass that “type” to that method? Along the lines of:

    [/crayon]

    I’m actually going to redo it so I don’t need to pass in the iterator anyway but I’m still curious either way, is it possible?

    #1038

    Mark Sibly
    Keymaster

    Not 100% sure what you mean here, but the general idea of the iterator ‘Erase’ method is that the iterator already points to the thing you want to erase, so the second RemoveRect doesn’t make sense to me: if ‘i’ doesn’t point to the ‘r’ you want to erase, you’ll need to find it first so ‘i’ is redundant. If ‘i’ does point to the ‘r’ you want to erase, then the ‘r’ is redundant!

     

     

    #1042

    peterigz
    Participant

    I was just curious about how you actually pass an iterator to a function. Or how do you pass a “type” that is a sub type (if that’s what it’s called) of a class. And in preparing an example I’ve actually found out how 🙂 –

    [/crayon]

    Before I was just using List.Iterator without specifying the <generic> bit.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.