28 #include "ThirdParty/robin_hood/robin_hood.h"
34 using Map = robin_hood::unordered_map<Value, Count>;
36 bool operator()(Map::value_type
const&
a, Map::value_type
const& b)
const {
37 return a.second < b.second;
41 std::lock_guard<std::mutex> lock(
mutex_);
42 auto const [itr, emplaced] =
map_.emplace(value, 1u);
48 std::lock_guard<std::mutex> lock(
mutex_);
49 if (
map_.size() < rhs.map_.size()) {
51 map_ = std::move(rhs.map_);
56 std::optional<Value>
mode()
const {
59 return itr ==
map_.end() ? std::nullopt : std::make_optional(itr->first);
64 for (Map::value_type
const& pair : map) {
65 auto const [itr, emplaced] =
map_.emplace(pair);
67 itr->second += pair.second;
void reduce(AggMode &&rhs)
robin_hood::unordered_map< Value, Count > Map
void reduceMap(Map const &map)
bool operator()(Map::value_type const &a, Map::value_type const &b) const
std::optional< Value > mode() const
void add(Value const value)