I'm not sure what happened to this code:
std::vector<int> myVector(0); if (myVector.back() == 12) myVector.push_back(12);
It seems that callback () on an empty vector resets the program.
I do not understand why it is crumbling? Do I need to check the length of a vector before calling back() ? or is it possible that this is a mistake?
The documentation says that if the vector is empty, it returns undefined.
source share