Help with template class

Hi, I made a Double Linked List data structure. But I am in a snag for a certain part of my program. I have a player class, with name,age,exp. I can add players to my list and stuff ok.

My problem is this:
I want to search my list based on one of those fields. For instance, I want to search each players exp field, and see if it matches a certain number. But, I am stumped how I can do this. My custom list is a tenplate class. So, How can I iterate through the list and pick out only the players that have exp at say 100?
I call the search using list.Search(some params) from my main method. I don't want to use a "predicate" class if that is possible.
You've asked the exact same thing yesterday. Look, you can either use a predicate class, a predicate function, or embed the logic of how to search for a player in the list class. The third one is obviously flawed.

Other than that you could also create a search object of player and try to get away with a simple equality comparison, but in that case you could not search for example only for exp, you would have to search for an exact match.
Ok, sorry I just wanted to know if there was another way, I marked other as solved and didnt knew if I could still writ there.....

But also, If I am searching a linked list, is the complexity O(n)? Do I have to look at each node sequentially?
But also, If I am searching a linked list, is the complexity O(n)?

You got no random access with linked lists, so yes.
Topic archived. No new replies allowed.