To check if an item exists in a std::vector, use std::find from the
#include
#include
#include
int main() {
std::vector
int item = 3;
auto it = std::find(vec.begin(), vec.end(), item);
if (it != vec.end()) {
std::cout << "Item found at index: " << std::distance(vec.begin(), it) << std::endl;
} else {
std::cout << "Item not found" << std::endl;
}