ATLAS Offline Software
Loading...
Searching...
No Matches
Control
CxxUtils
CxxUtils
transparent_string_hash.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration.
3
*/
4
#ifndef CXXUTILS_TRANSPARENT_STRING_HASH_H
5
#define CXXUTILS_TRANSPARENT_STRING_HASH_H
6
7
#include <cstddef>
8
#include <functional>
// std::hash
9
#include <string>
10
#include <string_view>
11
12
namespace
CxxUtils
{
13
60
struct
TransparentStringHash
{
61
using
is_transparent
= void;
62
68
std::size_t
69
operator()
(std::string_view s)
const
{
70
return
std::hash<std::string_view>{}(s);
71
}
72
78
std::size_t
79
operator()
(
const
std::string& s)
const
{
80
return
(*
this
)(std::string_view{s});
81
}
82
88
std::size_t
89
operator()
(
const
char
* s)
const
{
90
return
(*
this
)(std::string_view{s});
91
}
92
};
93
94
}
// namespace CxxUtils
95
96
#endif
CxxUtils
Definition
aligned_vector.h:29
CxxUtils::TransparentStringHash
Transparent hash functor for string-like keys.
Definition
transparent_string_hash.h:60
CxxUtils::TransparentStringHash::is_transparent
void is_transparent
Definition
transparent_string_hash.h:61
CxxUtils::TransparentStringHash::operator()
std::size_t operator()(const std::string &s) const
Hash a string.
Definition
transparent_string_hash.h:79
CxxUtils::TransparentStringHash::operator()
std::size_t operator()(const char *s) const
Hash a C string.
Definition
transparent_string_hash.h:89
CxxUtils::TransparentStringHash::operator()
std::size_t operator()(std::string_view s) const
Hash a string view.
Definition
transparent_string_hash.h:69
Generated on
for ATLAS Offline Software by
1.16.1