export module map; import std; namespace brc { export struct entry { std::uint64_t key_hash = 0; const char* key_ptr = nullptr; // 8, 8 std::int64_t total = 0; // 8, 26 std::int32_t min = std::numeric_limits::max(); // 4, 12 std::int32_t max = std::numeric_limits::min(); // 4, 16 std::uint32_t count = 0; // 4, 30 std::uint16_t key_len = 0; // 2, 32 }; export class map { private: std::size_t entry_count; std::unique_ptr entries; [[nodiscard]] static std::uint64_t get_key(std::string_view city) noexcept; [[nodiscard]] std::uint64_t get_index(std::string_view city) const noexcept; public: explicit map(std::size_t entry_count); void insert(std::string_view city, std::int32_t measurement); [[nodiscard]] entry& operator[](std::string_view city); void merge_against(const map& other); [[nodiscard]] std::vector collapse() const noexcept; }; } // namespace brc