This commit is contained in:
ZY4N
2024-12-22 16:58:40 +01:00
parent 2704814de2
commit db8db8f9d7
161 changed files with 17102 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
#pragma once
#include <unordered_map>
#include <string>
#include <string_view>
namespace ztu
{
namespace detail
{
struct string_hash
{
using is_transparent = void;
using hash_type = std::hash<std::string_view>;
[[nodiscard]] std::size_t operator()(const char *txt) const
{
return hash_type{}(txt);
}
[[nodiscard]] std::size_t operator()(std::string_view txt) const
{
return hash_type{}(txt);
}
[[nodiscard]] std::size_t operator()(const std::string &txt) const
{
return hash_type{}(txt);
}
};
}
template<typename T>
using string_lookup = std::unordered_map<std::string, T, detail::string_hash, std::equal_to<>>;
}