check if element exists in set c++ code example
Example: check if set contains element c++
set<T>::iterator it = theSet.find(element);
if (it != theSet.end())
{
// The element was found
}
else
{
// The element was not found
}
set<T>::iterator it = theSet.find(element);
if (it != theSet.end())
{
// The element was found
}
else
{
// The element was not found
}