Okay so I have this code:
GameObject Game::findObjectWithTag(const std::string& tag) {
for (auto gameObject : m_objectList) {
if (gamObjPtr->tag() == tag)
return *gamObjPtr;
}
}
All conditions must have a return is not required in c++, so I am just wondering how to tell when this function has not worked(the string inputed had not match). I cannot return NULL or a nullptr like in other languages so what do I do?