diff --git a/src/Collections/StringViewDictionary.hpp b/src/Collections/StringViewDictionary.hpp index 386bc18..ef822be 100644 --- a/src/Collections/StringViewDictionary.hpp +++ b/src/Collections/StringViewDictionary.hpp @@ -11,17 +11,24 @@ namespace ArbUt { /// @brief Wrapper around unordered_map, allowing safer access and adding several helper methods. template class StringViewDictionary { public: + /// @brief Custom hash class to allow for accessing values by both StringView and direct hash struct StringViewHash { + /// @brief The actual hash using hash_type = std::hash; + /// @brief As stolen from the documentation using is_transparent = void; - size_t operator()(const char* str) const { return hash_type{}(str); } + /// @brief Support hashing through a StringView size_t operator()(StringView const& str) const { return hash_type{}(str); } + /// @brief Support hashing through the direct hash access. size_t operator()(u32 hash) const { return hash; } }; + /// @brief The underlying std map used using map_type = typename std::unordered_map>; + /// @brief The iterator type of the Dictionary using iterator = typename map_type::iterator; + /// @brief The const iterator type of the Dictionary using const_iterator = typename map_type::const_iterator; private: