Adds missing documentation.
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Deukhoofd 2022-05-16 18:37:39 +02:00
parent eec26f2c12
commit 39ea396e2b
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
1 changed files with 8 additions and 1 deletions

View File

@ -11,17 +11,24 @@ namespace ArbUt {
/// @brief Wrapper around unordered_map, allowing safer access and adding several helper methods.
template <class ValueT> 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<StringView>;
/// @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<StringView, ValueT, StringViewHash, std::equal_to<>>;
/// @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: