If you want to know if an integer is in a given set of integers, then use std::set
:
std::set<int> accept { 1, 4, 6, 8, 255, 42 };
int x = 1;
if (!accept.count(x))
{
// ...
}
If you want to know if an integer is in a given set of integers, then use std::set
:
std::set<int> accept { 1, 4, 6, 8, 255, 42 };
int x = 1;
if (!accept.count(x))
{
// ...
}