Click here to Skip to main content
15,904,638 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to make a list that my program checks. It's too many entrees for an if or a switch. How can I build this list, lets say in a header and then reference from my code and come back with a true or a false, 1 or 0, being if it's on the list or not? Any directions, better ideas, I'm all ears! Thank you.
Posted

1 solution

Add the values you want to check against to a hash_set and then when you check if a value is in the list you use myHashSet.find(myValue) != myHashSet.end()
 
Share this answer
 
Comments
Member 7766180 1-Oct-11 19:08pm    
Thank you! Sincerely. my 5. I appreciate it.
Simon Bang Terkildsen 1-Oct-11 19:09pm    
My pleasure :)
RaisKazi 2-Oct-11 1:46am    
Five.
Simon Bang Terkildsen 2-Oct-11 5:25am    
Thank you, Rais

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900