2023-07-29 17:41:45 -04:00
|
|
|
/*
|
|
|
|
* Created by Brett on 31/03/23.
|
|
|
|
* Licensed under GNU General Public License V3.0
|
|
|
|
* See LICENSE file for license detail
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef BLT_HASH_MAP_H
|
|
|
|
#define BLT_HASH_MAP_H
|
|
|
|
|
2023-09-13 16:49:56 -04:00
|
|
|
namespace blt
|
|
|
|
{
|
2024-02-25 14:39:56 -05:00
|
|
|
|
2023-09-13 16:49:56 -04:00
|
|
|
// template<typename K, typename V, typename Hash = std::hash<K>, typename Eq = std::equal_to<K>>
|
|
|
|
// class hashmap
|
|
|
|
// {
|
|
|
|
// private:
|
|
|
|
//
|
|
|
|
// public:
|
|
|
|
//
|
|
|
|
// };
|
2024-02-25 14:39:56 -05:00
|
|
|
|
2023-09-13 16:49:56 -04:00
|
|
|
}
|
|
|
|
|
2023-07-29 17:41:45 -04:00
|
|
|
#ifndef HASHMAP
|
|
|
|
#if defined __has_include && __has_include(<parallel_hashmap/phmap.h>)
|
2023-07-30 14:04:59 -04:00
|
|
|
|
|
|
|
#include <parallel_hashmap/phmap.h>
|
2023-07-29 17:41:45 -04:00
|
|
|
#include <parallel_hashmap/phmap_fwd_decl.h>
|
2023-07-30 14:04:59 -04:00
|
|
|
|
2024-02-25 14:39:56 -05:00
|
|
|
namespace blt
|
|
|
|
{
|
|
|
|
template<class K, class V,
|
|
|
|
class Hash = phmap::priv::hash_default_hash <K>,
|
|
|
|
class Eq = phmap::priv::hash_default_eq <K>,
|
|
|
|
class Alloc = phmap::priv::Allocator <phmap::priv::Pair<const K, V>>>
|
|
|
|
using hashmap_t = phmap::flat_hash_map<K, V, Hash, Eq, Alloc>;
|
|
|
|
template<class T,
|
|
|
|
class Hash = phmap::priv::hash_default_hash <T>,
|
|
|
|
class Eq = phmap::priv::hash_default_eq <T>,
|
|
|
|
class Alloc = phmap::priv::Allocator <T>>
|
|
|
|
using hashset_t = phmap::flat_hash_set<T, Hash, Eq, Alloc>;
|
|
|
|
}
|
2023-07-29 17:41:45 -04:00
|
|
|
#else
|
|
|
|
#include <unordered_map>
|
|
|
|
#include <unordered_set>
|
2024-02-29 08:20:23 -05:00
|
|
|
namespace blt {
|
2023-07-29 17:41:45 -04:00
|
|
|
|
2024-02-25 14:39:56 -05:00
|
|
|
template<typename K, typename V,
|
2023-07-30 14:04:59 -04:00
|
|
|
typename Hash = std::hash<K>,
|
|
|
|
typename Eq = std::equal_to<K>,
|
|
|
|
typename Alloc = std::allocator<std::pair<const K, V>>>
|
2024-02-25 14:39:56 -05:00
|
|
|
using hashmap_t = std::unordered_map<K, V, Hash, Eq, Alloc>;
|
|
|
|
|
|
|
|
template<typename K,
|
2023-07-30 14:04:59 -04:00
|
|
|
typename Hash = std::hash<K>,
|
|
|
|
typename Eq = std::equal_to<K>,
|
|
|
|
typename Alloc = std::allocator<K>>
|
2024-02-25 14:39:56 -05:00
|
|
|
using hashset_t = std::unordered_set<K, Hash, Eq, Alloc>;
|
|
|
|
}
|
2023-07-29 17:41:45 -04:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif //BLT_HASH_MAP_H
|