So I have been trying to eradicate this error for a few hours now but I was unable to. I am making a 2D game where I am reading different maps for different screens.
This is where I get the error. I call this in my main. Here, curr_map_ is a string and mapper is an object of Map.
The line that you say generates the errors doesn't even appear in the code that you posted, which makes it hard to diagnose.
From your description, the line of code appears to be okay. That probably means that the actual error is before that line, probably on the previous line. It's just that the compiler didn't realize there was a problem until it got to the line you posted.
then the error is not where you think it is. there are only 2 things that can go wrong with the function you indicated. The first is if you managed to go out of bounds in your loop. It can't do that, as your loop is worked off size() which is assured to work (unless you have some weird offbeat compiler and found a bug in it). The second is it skips the returns and the result of the call is undefined, which could cause an access blow up but you said fixing that error did not help. That indicates the error is actually somewhere else. The only way I know to find the issue when the errors are unhelpful is the binary search, code style. go into main and start commenting out lines in main until it runs, then put them back until it crashes, then you know what to trace.