forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFilePath.h
More file actions
24 lines (19 loc) · 663 Bytes
/
Copy pathFilePath.h
File metadata and controls
24 lines (19 loc) · 663 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#pragma once
#include <string>
namespace codeql {
// wrapper around `std::string` mainly intended to unambiguously go into an `std::variant`
// TODO probably not needed once we can use `std::filesystem::path`
struct FilePath {
FilePath() = default;
FilePath(const std::string& path) : path{path} {}
FilePath(std::string&& path) : path{std::move(path)} {}
std::string path;
bool operator==(const FilePath& other) const { return path == other.path; }
};
} // namespace codeql
namespace std {
template <>
struct hash<codeql::FilePath> {
size_t operator()(const codeql::FilePath& value) { return hash<string>{}(value.path); }
};
} // namespace std