I see there is no const operator method for both std::map and boost::unordered_map. Why is that? I'm almost done with a tree-like structure of maps and wrote adapter to have such functionality... I wonder if I made a pit for me or others to fall into or what?
And what happens when there's no entry with that key in the map? Normally, it would cause it to be inserted, but a const version of operator can't do that. That leaves throwing an exception, resulting in entirely different behavior of the two versions. Certainly not desirable.
And like Peter87 already said, now there's at(), which has a const and non-const version - and both behave the same.
Actually true about access: would be ugly to use full path
through operator()s. So I myself confused tree population
for test purposes, which happen easily with those operators,
with RO access?!
Since the new map::at() may throw, I guess it's all merely
about avoidance of confusion. But is it so likely to not
know what kind of an object/ref is used: const or RW?
Could Athar elaborate on why not to allow operator const
to throw if it can't find the key?