3 #include <boost/container/flat_map.hpp>
9 boost::container::flat_map<T,std::size_t>
m_data;
13 void inc(
const T& key, std::size_t
inc) {
14 m_data.try_emplace(key).first->second +=
inc;
18 void collect(std::map<std::string, std::string>& data,
const std::string& key)
const {
20 for (
const auto& [k,v] :
m_data) {
22 ss <<
"=" << v <<
";";
24 data.emplace(key, ss.str());
25 data.emplace(key +
".total", std::to_string(
m_total));
void serialize(std::stringstream &ss, const std::pair< T, S > &pair)
boost::container::flat_map< T, std::size_t > m_data
void collect(std::map< std::string, std::string > &data, const std::string &key) const
void inc(const T &key, std::size_t inc)