how to check if a element is present 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
}