You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Except by following the standard, operator[] is unchecked where a at should be checked. I.E. accessing an invalid key/index via operator[] is supposed to be UB. If you want a checked version then you should use an at (if this library doesn't have an at then it should be added, I don't recall...).
The behavior of const operator[] is documented. The goal is to have quick access without checking overhead. For the latter, there is at.
There have been long discussions about the behavior. In conclusion, we would rather have a const operator[] version with the current semantics than just a copy of at. We are aware of std::map not having a const operator[].
To be sure, always use at, or find in combination with operator[].
Feature Request
I'd rather have an out_of_range exception thrown than undefined behavior that kills my app (VS2015).
The text was updated successfully, but these errors were encountered: