userver: userver/storages/postgres/detail/string_hash.hpp Source File
⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
string_hash.hpp
1#pragma once
2
3#include <cstdint>
4#include <string_view>
5
6USERVER_NAMESPACE_BEGIN
7
8namespace storages::postgres::utils {
9
10std::size_t StrHash(const char* str, std::size_t len);
11inline std::size_t StrHash(const std::string_view& str) {
12 return StrHash(str.data(), str.size());
13}
14
15struct StringViewHash {
16 std::size_t operator()(const std::string_view& str) const {
17 return StrHash(str);
18 }
19};
20
21} // namespace storages::postgres::utils
22
23USERVER_NAMESPACE_END