1 #ifndef __TAN_SRC_BASE_CONTAINER_H__
2 #define __TAN_SRC_BASE_CONTAINER_H__
4 #include <unordered_map>
5 #include <unordered_set>
12 template <
typename T>
using vector = std::vector<T>;
14 using str = std::string;
15 using str_view = std::string_view;
17 template <
typename Key,
typename Value,
typename Hash = std::hash<Key>>
18 using umap = std::unordered_map<Key, Value, Hash>;
20 template <
typename Key,
typename Hash = std::hash<Key>>
using uset = std::unordered_set<Key, Hash>;
26 template <
class T1,
class T2> std::size_t operator()(
const pair<T1, T2> &p)
const {
28 size_t lhs = std::hash<T1>{}(p.first);
29 size_t rhs = std::hash<T2>{}(p.second);
30 lhs ^= rhs + 0x9e3779b9 + (lhs << 6) + (lhs >> 2);
35 inline bool is_string_in(
const str &s,
const vector<str> &list) {
36 return std::find(list.begin(), list.end(), s) != list.end();