how to check if an element in set in cpp 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
}