 Hey everybody, it's Brian and welcome to the 38th Qt tutorial with C++ and GUI programming. We're going to continue our conversation about the Q list and iterators. I already have some code written, very simple. It just creates a list, populates the list. So didn't want to waste your time adding that in there, so let's just jump right in here. We'll say Q and list iterator. We got to give it a generic type. I'll either give it the list. Sorry about that. I don't have my glasses on again. I'm nearsighted and I'm trying to wean myself off my glasses. So if anybody has any experience with that, let me know. I'd be really interested in knowing if my eyes will actually improve or not. So we'll say while iter has next. And what we're going to do is we're going to say we want to go through this list and modify it. So let's just say int i equal iter next. So we're going to grab that item and we're going to say if i equal 5, we're going to say 5's been bad so we want to get rid of 5. Well we want to remove it from the list. So how would you do that? Well if you say iter dot and you try to remove, there's nothing there. How about delete? Nope. Well what you need is you need a different iterator. So let's go q mutable list iterator. Now what's the difference between a q list iterator and q mutable list iterator? Well other than this snazzy word mutable, there's not a whole lot different. What does mutable mean? Mutable means it will change. Whenever you see the word mute in programming, typically they're not talking about the speaker volume. They're talking about mutations, mutating something or changing something. So what we're doing is we're creating a iterator that will change and we'll say at this point iter dot remove. So let's review this real quick here. We're going through our list. Our list has already been generated and then we're going to iterate through each one and if it's a certain value, we're going to remove it. Now why would you do something like this? Well let's say this is a list of cars and we want all cars that are not black. The customer doesn't want a black car. Why? I don't know. I'd love a black car. But anyways, if it's a certain value then remove it from our list and then we can just simply say iter dot to front and then while iter has next and let's just print this out. q debug, iter next. So we're just going to print that out now that we've mutated or modified the list here. Compile and run and if everything goes as planned, sure enough it took five out of that list. Now you may be wondering why you didn't just go into the list and do the remove beforehand. Well you could have done that but I really wanted to show you the iterator and the q mutable list iterator because they are very powerful and they get into some more complex code which we'll be covering soon like how to sort and search and things of that nature. This is Brian. I hope you found this video educational and entertaining and thank you for watching.