#include <map>
#include <string>
#include <iostream>
std::ostream& operator<<(std::ostream &os, std::pair<std::string, int> const &s)
{
os << s.first << " served " << s.second;
return os;
}
int main()
{
std::map<std::string, int> servers;
servers["foo"]++;
servers["foo"]++;
servers["foo"]++;
servers["foo"]++;
servers["bar"]++;
servers["bar"]++;
for (auto s : servers)
std::cout << s << '\n';
}
solved How to use map container?