Why can’t I access elements with operator[] in a const std::map?
at() is a new method for std::map in C++11. Rather than insert a new default constructed element as operator[] does if an element with the given key does not exist, it throws a std::out_of_range exception. (This is similar to the behaviour of at() for deque and vector.) Because of this behaviour it makes sense for … Read more