auto it = std::find(vecArr.begin(), vecArr.end(), 5); if(it != vecArr.end()) vecArr.erase(it); ____________________________________
it = vecArr.erase(it); // Now iterator ’it’ is invalidated because it // still points to old location, which has been deleted. for(; it != vecArr.end(); it++)//Unpredicted Behavior std::cout<<(*it)<<"␣␣"; //Unpredicted Behavior