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
9namespace VoltMod
10{
11
12/** Hashes std::string and std::string_view alike, so a @ref StringMap looks up a view without a copy. */
14{
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. */
20template <class Value>
21using StringMap = std::unordered_map<std::string, Value, StringHash, std::equal_to<>>;
22
23} // namespace VoltMod
static std::string ReadFile(const std::filesystem::path &path)
Definition Loader.cpp:56
std::unordered_map< std::string, Value, StringHash, std::equal_to<> > StringMap
Definition StringMap.hpp:21
std::size_t operator()(std::string_view text) const
Definition StringMap.hpp:16