phmap_fwd_decl.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. #if !defined(phmap_fwd_decl_h_guard_)
  2. #define phmap_fwd_decl_h_guard_
  3. // ---------------------------------------------------------------------------
  4. // Copyright (c) 2019, Gregory Popovitch - [email protected]
  5. //
  6. // Licensed under the Apache License, Version 2.0 (the "License");
  7. // you may not use this file except in compliance with the License.
  8. // You may obtain a copy of the License at
  9. //
  10. // https://www.apache.org/licenses/LICENSE-2.0
  11. // ---------------------------------------------------------------------------
  12. #ifdef _MSC_VER
  13. #pragma warning(push)
  14. #pragma warning(disable : 4514) // unreferenced inline function has been removed
  15. #pragma warning(disable : 4710) // function not inlined
  16. #pragma warning(disable : 4711) // selected for automatic inline expansion
  17. #endif
  18. #include <memory>
  19. #include <utility>
  20. #include <mutex>
  21. #if defined(PHMAP_USE_ABSL_HASH) && !defined(ABSL_HASH_HASH_H_)
  22. namespace absl { template <class T> struct Hash; };
  23. #endif
  24. namespace phmap {
  25. #if defined(PHMAP_USE_ABSL_HASH)
  26. template <class T> using Hash = ::absl::Hash<T>;
  27. #else
  28. template <class T> struct Hash;
  29. #endif
  30. template <class T> struct EqualTo;
  31. template <class T> struct Less;
  32. template <class T> using Allocator = typename std::allocator<T>;
  33. template<class T1, class T2> using Pair = typename std::pair<T1, T2>;
  34. class NullMutex;
  35. namespace priv {
  36. // The hash of an object of type T is computed by using phmap::Hash.
  37. template <class T, class E = void>
  38. struct HashEq
  39. {
  40. using Hash = phmap::Hash<T>;
  41. using Eq = phmap::EqualTo<T>;
  42. };
  43. template <class T>
  44. using hash_default_hash = typename priv::HashEq<T>::Hash;
  45. template <class T>
  46. using hash_default_eq = typename priv::HashEq<T>::Eq;
  47. // type alias for std::allocator so we can forward declare without including other headers
  48. template <class T>
  49. using Allocator = typename phmap::Allocator<T>;
  50. // type alias for std::pair so we can forward declare without including other headers
  51. template<class T1, class T2>
  52. using Pair = typename phmap::Pair<T1, T2>;
  53. } // namespace priv
  54. // ------------- forward declarations for hash containers ----------------------------------
  55. template <class T,
  56. class Hash = phmap::priv::hash_default_hash<T>,
  57. class Eq = phmap::priv::hash_default_eq<T>,
  58. class Alloc = phmap::priv::Allocator<T>> // alias for std::allocator
  59. class flat_hash_set;
  60. template <class K, class V,
  61. class Hash = phmap::priv::hash_default_hash<K>,
  62. class Eq = phmap::priv::hash_default_eq<K>,
  63. class Alloc = phmap::priv::Allocator<
  64. phmap::priv::Pair<const K, V>>> // alias for std::allocator
  65. class flat_hash_map;
  66. template <class T,
  67. class Hash = phmap::priv::hash_default_hash<T>,
  68. class Eq = phmap::priv::hash_default_eq<T>,
  69. class Alloc = phmap::priv::Allocator<T>> // alias for std::allocator
  70. class node_hash_set;
  71. template <class Key, class Value,
  72. class Hash = phmap::priv::hash_default_hash<Key>,
  73. class Eq = phmap::priv::hash_default_eq<Key>,
  74. class Alloc = phmap::priv::Allocator<
  75. phmap::priv::Pair<const Key, Value>>> // alias for std::allocator
  76. class node_hash_map;
  77. template <class T,
  78. class Hash = phmap::priv::hash_default_hash<T>,
  79. class Eq = phmap::priv::hash_default_eq<T>,
  80. class Alloc = phmap::priv::Allocator<T>, // alias for std::allocator
  81. size_t N = 4, // 2**N submaps
  82. class Mutex = phmap::NullMutex> // use std::mutex to enable internal locks
  83. class parallel_flat_hash_set;
  84. template <class K, class V,
  85. class Hash = phmap::priv::hash_default_hash<K>,
  86. class Eq = phmap::priv::hash_default_eq<K>,
  87. class Alloc = phmap::priv::Allocator<
  88. phmap::priv::Pair<const K, V>>, // alias for std::allocator
  89. size_t N = 4, // 2**N submaps
  90. class Mutex = phmap::NullMutex> // use std::mutex to enable internal locks
  91. class parallel_flat_hash_map;
  92. template <class T,
  93. class Hash = phmap::priv::hash_default_hash<T>,
  94. class Eq = phmap::priv::hash_default_eq<T>,
  95. class Alloc = phmap::priv::Allocator<T>, // alias for std::allocator
  96. size_t N = 4, // 2**N submaps
  97. class Mutex = phmap::NullMutex> // use std::mutex to enable internal locks
  98. class parallel_node_hash_set;
  99. template <class Key, class Value,
  100. class Hash = phmap::priv::hash_default_hash<Key>,
  101. class Eq = phmap::priv::hash_default_eq<Key>,
  102. class Alloc = phmap::priv::Allocator<
  103. phmap::priv::Pair<const Key, Value>>, // alias for std::allocator
  104. size_t N = 4, // 2**N submaps
  105. class Mutex = phmap::NullMutex> // use std::mutex to enable internal locks
  106. class parallel_node_hash_map;
  107. // -----------------------------------------------------------------------------
  108. // phmap::parallel_*_hash_* using std::mutex by default
  109. // -----------------------------------------------------------------------------
  110. template <class T,
  111. class Hash = phmap::priv::hash_default_hash<T>,
  112. class Eq = phmap::priv::hash_default_eq<T>,
  113. class Alloc = phmap::priv::Allocator<T>,
  114. size_t N = 4>
  115. using parallel_flat_hash_set_m = parallel_flat_hash_set<T, Hash, Eq, Alloc, N, std::mutex>;
  116. template <class K, class V,
  117. class Hash = phmap::priv::hash_default_hash<K>,
  118. class Eq = phmap::priv::hash_default_eq<K>,
  119. class Alloc = phmap::priv::Allocator<phmap::priv::Pair<const K, V>>,
  120. size_t N = 4>
  121. using parallel_flat_hash_map_m = parallel_flat_hash_map<K, V, Hash, Eq, Alloc, N, std::mutex>;
  122. template <class T,
  123. class Hash = phmap::priv::hash_default_hash<T>,
  124. class Eq = phmap::priv::hash_default_eq<T>,
  125. class Alloc = phmap::priv::Allocator<T>,
  126. size_t N = 4>
  127. using parallel_node_hash_set_m = parallel_node_hash_set<T, Hash, Eq, Alloc, N, std::mutex>;
  128. template <class K, class V,
  129. class Hash = phmap::priv::hash_default_hash<K>,
  130. class Eq = phmap::priv::hash_default_eq<K>,
  131. class Alloc = phmap::priv::Allocator<phmap::priv::Pair<const K, V>>,
  132. size_t N = 4>
  133. using parallel_node_hash_map_m = parallel_node_hash_map<K, V, Hash, Eq, Alloc, N, std::mutex>;
  134. // ------------- forward declarations for btree containers ----------------------------------
  135. template <typename Key, typename Compare = phmap::Less<Key>,
  136. typename Alloc = phmap::Allocator<Key>>
  137. class btree_set;
  138. template <typename Key, typename Compare = phmap::Less<Key>,
  139. typename Alloc = phmap::Allocator<Key>>
  140. class btree_multiset;
  141. template <typename Key, typename Value, typename Compare = phmap::Less<Key>,
  142. typename Alloc = phmap::Allocator<phmap::priv::Pair<const Key, Value>>>
  143. class btree_map;
  144. template <typename Key, typename Value, typename Compare = phmap::Less<Key>,
  145. typename Alloc = phmap::Allocator<phmap::priv::Pair<const Key, Value>>>
  146. class btree_multimap;
  147. } // namespace phmap
  148. #ifdef _MSC_VER
  149. #pragma warning(pop)
  150. #endif
  151. #endif // phmap_fwd_decl_h_guard_