Yeah, it happens. One of the worst kinds of bugs. I had plenty of similar bugs myself.
Here's a tip. If you want to pass by reference but don't want to accidentally change it, declare it with const in function. For example:
void coolfunction(const vector<int> &v);
Yeah, it happens. One of the worst kinds of bugs. I had plenty of similar bugs myself.
Here's a tip. If you want to pass by reference but don't want to accidentally change it, declare it with const in function. For example:
void coolfunction(const vector<int> &v);