rug-compling/alpinocorpus — comment on commit d8cfdda07e9c5d1dfafdcec11d55fb95b9e55eff
File:  line 0
By danieldk:

I wouldn't leave them both in: the smaller the number of methods, the better.

headers() provides more information than header, without any harm (since it is a const ref).

Using an iterator implies more boilerplate, but it is also safer. When a non-existing key is used, there is no way to verify whether the key was actually present. If the key is not present, map will use the default constructor to construct a value, which gives exactly the same value if the key was present with a value constructed with the default constructor.

With find() on the other hand, if a key is not present, it will return an end iterator.

Don't decide for the user that he doesn't need safety ;).