If std::findit cannot find a specific value, it will return the "end" of the iterator pair.
else if (std::find(visited.begin(), visited.end(), x) == visited.end())
{
Edit: if you want to know if there is x in deque, just change the condition.
else if (std::find(visited.begin(), visited.end(), x) != visited.end())
{
Edit: If you are not familiar with the concept of iterators in C ++, read Understanding Iterators in STL .
source
share