VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
StringMap.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <cstddef>
4
#include <functional>
5
#include <string>
6
#include <string_view>
7
#include <unordered_map>
8
9
namespace
VoltMod
10
{
11
12
/** Hashes std::string and std::string_view alike, so a @ref StringMap looks up a view without a copy. */
13
struct
StringHash
14
{
15
using
is_transparent
=
void
;
16
std::size_t
operator()
(std::string_view
text
)
const
{
return
std::hash<std::string_view>{}(
text
); }
17
};
18
19
/** A string-keyed map that finds a std::string_view key without building a string. */
20
template
<
class
Value>
21
using
StringMap
= std::unordered_map<std::string, Value, StringHash, std::equal_to<>>;
22
23
}
// namespace VoltMod
VoltMod
Definition
Options.hpp:13
VoltMod::ReadFile
static std::string ReadFile(const std::filesystem::path &path)
Definition
Loader.cpp:56
VoltMod::StringMap
std::unordered_map< std::string, Value, StringHash, std::equal_to<> > StringMap
Definition
StringMap.hpp:21
VoltMod::StringHash
Definition
StringMap.hpp:14
VoltMod::StringHash::operator()
std::size_t operator()(std::string_view text) const
Definition
StringMap.hpp:16
VoltMod::StringHash::is_transparent
void is_transparent
Definition
StringMap.hpp:15
include
VoltMod
Core
Text
StringMap.hpp
Generated by
1.9.8