 Hey everybody, it's Brian and welcome to the 46th Qtutorial with C++ and GUI programming and today we're going to cover the QFind algorithm. QFind allows you to find things within a container. So let's just make a QList and we're going to give it some ints. Just keep things simple. We'll call list. We're going to fill our list and we'll just say 1, 5, 15 and we'll say 23. Now what we want to do is we want to search that list and find a specific number. Now I know you're thinking, well I can just do a for loop and figure out which one it is, but there's a better and a faster way. It's called QFind, but to do QFind we've got to deal with the const iterator and I'm going to show you how to do that. So say QList, int and then you say const iterator and we'll just name it iter and then we're going to assign the value which is actually going to be QFind and we want to say the range which is list.begin to list.end and then the number we're looking for and I think we said we're going to look for 15. Now what that'll do is that'll search and if it doesn't find it, it's going to equal the end and I'll show you what I mean here. If iter and we'll say not equals list.end, I made a booboo here, bear with me. There we go. So if it doesn't equal list.end or the end of the list which is right here after the 23, then we found a value. So we'll say Qdebug and let's just say found and we want to actually print the value out. So we will say iter because remember this is a pointer and we'll say else, Qdebug and we're just going to say not found compile and run and we found 15 because there's 15 in our list and just to prove that this works, let's actually just throw a number in here. We know it doesn't exist, 99, compile and run and not found. So that's how Qfine works. Now I know you might be thinking that this is kind of a complex way of doing things, especially if you're coming from say visual basic or C sharp where you used to just going through an entire list looking for something. It may seem more complex but it's actually more elegant and it's much less error prone and I'll be it much faster. So I implore you to use it. This is Brian, I hope you found this video educational and entertaining and thank you for watching.