Write std::find in <algorithm>
std::find(vector.begin(), vector.end(), item) != vector.end()
You can use it with this
Returns true
if the item exists, and false
if it does not exist.
I'll attach a simple example
#include <algorithm>
if ( std::find(vector.begin(), vector.end(), item) != vector.end() )
do_this();
else
do that();
© 2024 OneMinuteCode. All rights reserved.