I've got a list of elements, say, integers and I want to check if my variable (another integer) is one of the elements from the list. In python I'd do:
my_list = [1,2,3,4] # elements
my_var = 3 # my variable
my_var in my_list # returns boolean
You can use
bool found = (std::find(my_var.begin(), my_var.end(), my_variable) != my_var.end());
You need to include
<algorithm>. It should work on standard containers, vectors lists, etc...