Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Difference between list and list::iterator  (Read 2398 times)

0 Members and 1 Guest are viewing this topic.

Bizarreofnature

  • Newbie
  • *
  • Posts: 48
    • View Profile
Difference between list and list::iterator
« on: October 25, 2017, 05:12:29 pm »
Hello there!

I hope this is the right section for my question. However:

What exactly is the difference between a list and list::iterator?
And when do I use those?

EDIT: And what is the difference between "remove" and "erase" ?

Thanks in advance,
Bizarreofnature
« Last Edit: October 25, 2017, 05:36:12 pm by Bizarreofnature »

sjaustirni

  • Jr. Member
  • **
  • Posts: 94
    • View Profile
Re: Difference between list and list::iterator
« Reply #1 on: October 25, 2017, 05:53:35 pm »
That is a C++ question. This is the SFML forum. For C++-only questions it is advised to seek another forum to post at.

Neverthless, regarding your questions, you ought to read something about STL containers. Meanwhile read here: http://www.cplusplus.com/reference/iterator/ and http://www.cplusplus.com/reference/list/list/

Bizarreofnature

  • Newbie
  • *
  • Posts: 48
    • View Profile
Re: Difference between list and list::iterator
« Reply #2 on: October 25, 2017, 06:04:00 pm »
Thank you for your answer.

I see. I am sorry about posting it in the wrong forum, I just did because it directly affects my Game that I code.

So a list contains objects and an iterator is used to work them off piece by piece.

May I be allowed to ask a last question, even if it is the wrong forum.

Remove just removes objects from the list but erase destroys them?

Bizarreofnature

  • Newbie
  • *
  • Posts: 48
    • View Profile
Re: Difference between list and list::iterator
« Reply #3 on: October 25, 2017, 06:22:56 pm »
It is ok, i just read it. Thanks!