Photon Common Library
2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
detail.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <cstddef>
4
#include <string>
5
#include <string_view>
6
#include <functional>
7
8
namespace
ph::detail
9
{
10
11
// References:
12
// [1] https://www.cppstories.com/2021/heterogeneous-access-cpp20/
13
// [2] https://en.cppreference.com/w/cpp/container/unordered_map/find
14
struct
HeterogeneousStringHash
15
{
16
using
is_transparent
= void;
17
18
[[nodiscard]]
19
std::size_t
operator ()
(
const
char
* txt)
const
20
{
21
return
std::hash<std::string_view>{}(txt);
22
}
23
24
[[nodiscard]]
25
std::size_t
operator ()
(std::string_view txt)
const
26
{
27
return
std::hash<std::string_view>{}(txt);
28
}
29
30
[[nodiscard]]
31
std::size_t
operator ()
(
const
std::string& txt)
const
32
{
33
return
std::hash<std::string>{}(txt);
34
}
35
};
36
37
}
// end namespace ph::detail
ph::detail
Implementation detail mainly for internal usages.
Definition
assertion.h:9
ph::detail::HeterogeneousStringHash
Definition
detail.h:15
ph::detail::HeterogeneousStringHash::operator()
std::size_t operator()(const char *txt) const
Definition
detail.h:19
ph::detail::HeterogeneousStringHash::is_transparent
void is_transparent
Definition
detail.h:16
Include
Common
Container
detail.h
Generated by
1.11.0