C++17 STL Cookbook
上QQ阅读APP看书,第一时间看更新

Implementing a word frequency counter with std::map

The std::map is very useful when categorizing something in order to collect statistics about that data. By attaching modifiable payload objects to every key which represents an object category, it is pretty simple to implement a histogram of word frequencies for example. This is what we will do in this section.