Use std::map<K, V> rather than std::map<K, std::unique_ptr<V>>

Pointers and references to map elements are never invalidated (except on
removal, which isn't used here) so there's no need for the indirection
unless there's polymorphism at work.

A little const correctness had to be fixed, since the indirection
allowed some benign const violations.