What do you think about these dark corners of stl? which ones would
you add?
Harly a dark corner, but I find a lot of programmers aren't
aware of std::accumulate (perhaps because it's in the math
section of the standard, rather than the algorithms). Define
a custom accumulator type, and it can be used for a lot of
things. For example, if I want to append an MD5 checksum to a
string, I'll use something like:
s += std::accumulate(s.begin(), s.end(), MD5Hasher());
(where s is a string, and MD5Hasher is an accumulator which
generates the MD5 checksum, and has an implicit conversion to
string which returns the hash generated so far).
Practically, accumulate is usable just about any time you want
to generate a single value which depends on a sequence of
values.