How to I Get a Pointer to Point to an Item an Iterator Is Pointing At?

I have an iterator going through a list of cars. I need to set a pointer to point at what the iterator is pointing at so I can move the iterator forward and delete the item the pointer is pointing at (what the iterator was previously pointing at)?
This is C++ programming.

Is this in .Net?

You can’t do that. When you’re in a foreach loop, you can’t modify the collection. Use a regular for loop instead.

Tags:
This entry was posted in Pointer Puppies and tagged . Bookmark the permalink.

One Response to How to I Get a Pointer to Point to an Item an Iterator Is Pointing At?

  1. Pfo says:

    Is this in .Net?

    You can’t do that. When you’re in a foreach loop, you can’t modify the collection. Use a regular for loop instead.
    References :

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>