node_hash_map.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  1. // Copyright 2018 The Abseil Authors.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // https://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. //
  15. // -----------------------------------------------------------------------------
  16. // File: node_hash_map.h
  17. // -----------------------------------------------------------------------------
  18. //
  19. // An `absl::node_hash_map<K, V>` is an unordered associative container of
  20. // unique keys and associated values designed to be a more efficient replacement
  21. // for `std::unordered_map`. Like `unordered_map`, search, insertion, and
  22. // deletion of map elements can be done as an `O(1)` operation. However,
  23. // `node_hash_map` (and other unordered associative containers known as the
  24. // collection of Abseil "Swiss tables") contain other optimizations that result
  25. // in both memory and computation advantages.
  26. //
  27. // In most cases, your default choice for a hash map should be a map of type
  28. // `flat_hash_map`. However, if you need pointer stability and cannot store
  29. // a `flat_hash_map` with `unique_ptr` elements, a `node_hash_map` may be a
  30. // valid alternative. As well, if you are migrating your code from using
  31. // `std::unordered_map`, a `node_hash_map` provides a more straightforward
  32. // migration, because it guarantees pointer stability. Consider migrating to
  33. // `node_hash_map` and perhaps converting to a more efficient `flat_hash_map`
  34. // upon further review.
  35. #ifndef ABSL_CONTAINER_NODE_HASH_MAP_H_
  36. #define ABSL_CONTAINER_NODE_HASH_MAP_H_
  37. #include <tuple>
  38. #include <type_traits>
  39. #include <utility>
  40. #include "absl/algorithm/container.h"
  41. #include "absl/container/internal/container_memory.h"
  42. #include "absl/container/internal/hash_function_defaults.h" // IWYU pragma: export
  43. #include "absl/container/internal/node_hash_policy.h"
  44. #include "absl/container/internal/raw_hash_map.h" // IWYU pragma: export
  45. #include "absl/memory/memory.h"
  46. namespace absl {
  47. ABSL_NAMESPACE_BEGIN
  48. namespace container_internal {
  49. template <class Key, class Value>
  50. class NodeHashMapPolicy;
  51. } // namespace container_internal
  52. // -----------------------------------------------------------------------------
  53. // absl::node_hash_map
  54. // -----------------------------------------------------------------------------
  55. //
  56. // An `absl::node_hash_map<K, V>` is an unordered associative container which
  57. // has been optimized for both speed and memory footprint in most common use
  58. // cases. Its interface is similar to that of `std::unordered_map<K, V>` with
  59. // the following notable differences:
  60. //
  61. // * Supports heterogeneous lookup, through `find()`, `operator[]()` and
  62. // `insert()`, provided that the map is provided a compatible heterogeneous
  63. // hashing function and equality operator.
  64. // * Contains a `capacity()` member function indicating the number of element
  65. // slots (open, deleted, and empty) within the hash map.
  66. // * Returns `void` from the `erase(iterator)` overload.
  67. //
  68. // By default, `node_hash_map` uses the `absl::Hash` hashing framework.
  69. // All fundamental and Abseil types that support the `absl::Hash` framework have
  70. // a compatible equality operator for comparing insertions into `node_hash_map`.
  71. // If your type is not yet supported by the `absl::Hash` framework, see
  72. // absl/hash/hash.h for information on extending Abseil hashing to user-defined
  73. // types.
  74. //
  75. // Example:
  76. //
  77. // // Create a node hash map of three strings (that map to strings)
  78. // absl::node_hash_map<std::string, std::string> ducks =
  79. // {{"a", "huey"}, {"b", "dewey"}, {"c", "louie"}};
  80. //
  81. // // Insert a new element into the node hash map
  82. // ducks.insert({"d", "donald"}};
  83. //
  84. // // Force a rehash of the node hash map
  85. // ducks.rehash(0);
  86. //
  87. // // Find the element with the key "b"
  88. // std::string search_key = "b";
  89. // auto result = ducks.find(search_key);
  90. // if (result != ducks.end()) {
  91. // std::cout << "Result: " << result->second << std::endl;
  92. // }
  93. template <class Key, class Value,
  94. class Hash = absl::container_internal::hash_default_hash<Key>,
  95. class Eq = absl::container_internal::hash_default_eq<Key>,
  96. class Alloc = std::allocator<std::pair<const Key, Value>>>
  97. class node_hash_map
  98. : public absl::container_internal::raw_hash_map<
  99. absl::container_internal::NodeHashMapPolicy<Key, Value>, Hash, Eq,
  100. Alloc> {
  101. using Base = typename node_hash_map::raw_hash_map;
  102. public:
  103. // Constructors and Assignment Operators
  104. //
  105. // A node_hash_map supports the same overload set as `std::unordered_map`
  106. // for construction and assignment:
  107. //
  108. // * Default constructor
  109. //
  110. // // No allocation for the table's elements is made.
  111. // absl::node_hash_map<int, std::string> map1;
  112. //
  113. // * Initializer List constructor
  114. //
  115. // absl::node_hash_map<int, std::string> map2 =
  116. // {{1, "huey"}, {2, "dewey"}, {3, "louie"},};
  117. //
  118. // * Copy constructor
  119. //
  120. // absl::node_hash_map<int, std::string> map3(map2);
  121. //
  122. // * Copy assignment operator
  123. //
  124. // // Hash functor and Comparator are copied as well
  125. // absl::node_hash_map<int, std::string> map4;
  126. // map4 = map3;
  127. //
  128. // * Move constructor
  129. //
  130. // // Move is guaranteed efficient
  131. // absl::node_hash_map<int, std::string> map5(std::move(map4));
  132. //
  133. // * Move assignment operator
  134. //
  135. // // May be efficient if allocators are compatible
  136. // absl::node_hash_map<int, std::string> map6;
  137. // map6 = std::move(map5);
  138. //
  139. // * Range constructor
  140. //
  141. // std::vector<std::pair<int, std::string>> v = {{1, "a"}, {2, "b"}};
  142. // absl::node_hash_map<int, std::string> map7(v.begin(), v.end());
  143. node_hash_map() {}
  144. using Base::Base;
  145. // node_hash_map::begin()
  146. //
  147. // Returns an iterator to the beginning of the `node_hash_map`.
  148. using Base::begin;
  149. // node_hash_map::cbegin()
  150. //
  151. // Returns a const iterator to the beginning of the `node_hash_map`.
  152. using Base::cbegin;
  153. // node_hash_map::cend()
  154. //
  155. // Returns a const iterator to the end of the `node_hash_map`.
  156. using Base::cend;
  157. // node_hash_map::end()
  158. //
  159. // Returns an iterator to the end of the `node_hash_map`.
  160. using Base::end;
  161. // node_hash_map::capacity()
  162. //
  163. // Returns the number of element slots (assigned, deleted, and empty)
  164. // available within the `node_hash_map`.
  165. //
  166. // NOTE: this member function is particular to `absl::node_hash_map` and is
  167. // not provided in the `std::unordered_map` API.
  168. using Base::capacity;
  169. // node_hash_map::empty()
  170. //
  171. // Returns whether or not the `node_hash_map` is empty.
  172. using Base::empty;
  173. // node_hash_map::max_size()
  174. //
  175. // Returns the largest theoretical possible number of elements within a
  176. // `node_hash_map` under current memory constraints. This value can be thought
  177. // of as the largest value of `std::distance(begin(), end())` for a
  178. // `node_hash_map<K, V>`.
  179. using Base::max_size;
  180. // node_hash_map::size()
  181. //
  182. // Returns the number of elements currently within the `node_hash_map`.
  183. using Base::size;
  184. // node_hash_map::clear()
  185. //
  186. // Removes all elements from the `node_hash_map`. Invalidates any references,
  187. // pointers, or iterators referring to contained elements.
  188. //
  189. // NOTE: this operation may shrink the underlying buffer. To avoid shrinking
  190. // the underlying buffer call `erase(begin(), end())`.
  191. using Base::clear;
  192. // node_hash_map::erase()
  193. //
  194. // Erases elements within the `node_hash_map`. Erasing does not trigger a
  195. // rehash. Overloads are listed below.
  196. //
  197. // void erase(const_iterator pos):
  198. //
  199. // Erases the element at `position` of the `node_hash_map`, returning
  200. // `void`.
  201. //
  202. // NOTE: this return behavior is different than that of STL containers in
  203. // general and `std::unordered_map` in particular.
  204. //
  205. // iterator erase(const_iterator first, const_iterator last):
  206. //
  207. // Erases the elements in the open interval [`first`, `last`), returning an
  208. // iterator pointing to `last`.
  209. //
  210. // size_type erase(const key_type& key):
  211. //
  212. // Erases the element with the matching key, if it exists, returning the
  213. // number of elements erased (0 or 1).
  214. using Base::erase;
  215. // node_hash_map::insert()
  216. //
  217. // Inserts an element of the specified value into the `node_hash_map`,
  218. // returning an iterator pointing to the newly inserted element, provided that
  219. // an element with the given key does not already exist. If rehashing occurs
  220. // due to the insertion, all iterators are invalidated. Overloads are listed
  221. // below.
  222. //
  223. // std::pair<iterator,bool> insert(const init_type& value):
  224. //
  225. // Inserts a value into the `node_hash_map`. Returns a pair consisting of an
  226. // iterator to the inserted element (or to the element that prevented the
  227. // insertion) and a `bool` denoting whether the insertion took place.
  228. //
  229. // std::pair<iterator,bool> insert(T&& value):
  230. // std::pair<iterator,bool> insert(init_type&& value):
  231. //
  232. // Inserts a moveable value into the `node_hash_map`. Returns a `std::pair`
  233. // consisting of an iterator to the inserted element (or to the element that
  234. // prevented the insertion) and a `bool` denoting whether the insertion took
  235. // place.
  236. //
  237. // iterator insert(const_iterator hint, const init_type& value):
  238. // iterator insert(const_iterator hint, T&& value):
  239. // iterator insert(const_iterator hint, init_type&& value);
  240. //
  241. // Inserts a value, using the position of `hint` as a non-binding suggestion
  242. // for where to begin the insertion search. Returns an iterator to the
  243. // inserted element, or to the existing element that prevented the
  244. // insertion.
  245. //
  246. // void insert(InputIterator first, InputIterator last):
  247. //
  248. // Inserts a range of values [`first`, `last`).
  249. //
  250. // NOTE: Although the STL does not specify which element may be inserted if
  251. // multiple keys compare equivalently, for `node_hash_map` we guarantee the
  252. // first match is inserted.
  253. //
  254. // void insert(std::initializer_list<init_type> ilist):
  255. //
  256. // Inserts the elements within the initializer list `ilist`.
  257. //
  258. // NOTE: Although the STL does not specify which element may be inserted if
  259. // multiple keys compare equivalently within the initializer list, for
  260. // `node_hash_map` we guarantee the first match is inserted.
  261. using Base::insert;
  262. // node_hash_map::insert_or_assign()
  263. //
  264. // Inserts an element of the specified value into the `node_hash_map` provided
  265. // that a value with the given key does not already exist, or replaces it with
  266. // the element value if a key for that value already exists, returning an
  267. // iterator pointing to the newly inserted element. If rehashing occurs due to
  268. // the insertion, all iterators are invalidated. Overloads are listed
  269. // below.
  270. //
  271. // std::pair<iterator, bool> insert_or_assign(const init_type& k, T&& obj):
  272. // std::pair<iterator, bool> insert_or_assign(init_type&& k, T&& obj):
  273. //
  274. // Inserts/Assigns (or moves) the element of the specified key into the
  275. // `node_hash_map`.
  276. //
  277. // iterator insert_or_assign(const_iterator hint,
  278. // const init_type& k, T&& obj):
  279. // iterator insert_or_assign(const_iterator hint, init_type&& k, T&& obj):
  280. //
  281. // Inserts/Assigns (or moves) the element of the specified key into the
  282. // `node_hash_map` using the position of `hint` as a non-binding suggestion
  283. // for where to begin the insertion search.
  284. using Base::insert_or_assign;
  285. // node_hash_map::emplace()
  286. //
  287. // Inserts an element of the specified value by constructing it in-place
  288. // within the `node_hash_map`, provided that no element with the given key
  289. // already exists.
  290. //
  291. // The element may be constructed even if there already is an element with the
  292. // key in the container, in which case the newly constructed element will be
  293. // destroyed immediately. Prefer `try_emplace()` unless your key is not
  294. // copyable or moveable.
  295. //
  296. // If rehashing occurs due to the insertion, all iterators are invalidated.
  297. using Base::emplace;
  298. // node_hash_map::emplace_hint()
  299. //
  300. // Inserts an element of the specified value by constructing it in-place
  301. // within the `node_hash_map`, using the position of `hint` as a non-binding
  302. // suggestion for where to begin the insertion search, and only inserts
  303. // provided that no element with the given key already exists.
  304. //
  305. // The element may be constructed even if there already is an element with the
  306. // key in the container, in which case the newly constructed element will be
  307. // destroyed immediately. Prefer `try_emplace()` unless your key is not
  308. // copyable or moveable.
  309. //
  310. // If rehashing occurs due to the insertion, all iterators are invalidated.
  311. using Base::emplace_hint;
  312. // node_hash_map::try_emplace()
  313. //
  314. // Inserts an element of the specified value by constructing it in-place
  315. // within the `node_hash_map`, provided that no element with the given key
  316. // already exists. Unlike `emplace()`, if an element with the given key
  317. // already exists, we guarantee that no element is constructed.
  318. //
  319. // If rehashing occurs due to the insertion, all iterators are invalidated.
  320. // Overloads are listed below.
  321. //
  322. // std::pair<iterator, bool> try_emplace(const key_type& k, Args&&... args):
  323. // std::pair<iterator, bool> try_emplace(key_type&& k, Args&&... args):
  324. //
  325. // Inserts (via copy or move) the element of the specified key into the
  326. // `node_hash_map`.
  327. //
  328. // iterator try_emplace(const_iterator hint,
  329. // const init_type& k, Args&&... args):
  330. // iterator try_emplace(const_iterator hint, init_type&& k, Args&&... args):
  331. //
  332. // Inserts (via copy or move) the element of the specified key into the
  333. // `node_hash_map` using the position of `hint` as a non-binding suggestion
  334. // for where to begin the insertion search.
  335. //
  336. // All `try_emplace()` overloads make the same guarantees regarding rvalue
  337. // arguments as `std::unordered_map::try_emplace()`, namely that these
  338. // functions will not move from rvalue arguments if insertions do not happen.
  339. using Base::try_emplace;
  340. // node_hash_map::extract()
  341. //
  342. // Extracts the indicated element, erasing it in the process, and returns it
  343. // as a C++17-compatible node handle. Overloads are listed below.
  344. //
  345. // node_type extract(const_iterator position):
  346. //
  347. // Extracts the key,value pair of the element at the indicated position and
  348. // returns a node handle owning that extracted data.
  349. //
  350. // node_type extract(const key_type& x):
  351. //
  352. // Extracts the key,value pair of the element with a key matching the passed
  353. // key value and returns a node handle owning that extracted data. If the
  354. // `node_hash_map` does not contain an element with a matching key, this
  355. // function returns an empty node handle.
  356. //
  357. // NOTE: when compiled in an earlier version of C++ than C++17,
  358. // `node_type::key()` returns a const reference to the key instead of a
  359. // mutable reference. We cannot safely return a mutable reference without
  360. // std::launder (which is not available before C++17).
  361. using Base::extract;
  362. // node_hash_map::merge()
  363. //
  364. // Extracts elements from a given `source` node hash map into this
  365. // `node_hash_map`. If the destination `node_hash_map` already contains an
  366. // element with an equivalent key, that element is not extracted.
  367. using Base::merge;
  368. // node_hash_map::swap(node_hash_map& other)
  369. //
  370. // Exchanges the contents of this `node_hash_map` with those of the `other`
  371. // node hash map, avoiding invocation of any move, copy, or swap operations on
  372. // individual elements.
  373. //
  374. // All iterators and references on the `node_hash_map` remain valid, excepting
  375. // for the past-the-end iterator, which is invalidated.
  376. //
  377. // `swap()` requires that the node hash map's hashing and key equivalence
  378. // functions be Swappable, and are exchaged using unqualified calls to
  379. // non-member `swap()`. If the map's allocator has
  380. // `std::allocator_traits<allocator_type>::propagate_on_container_swap::value`
  381. // set to `true`, the allocators are also exchanged using an unqualified call
  382. // to non-member `swap()`; otherwise, the allocators are not swapped.
  383. using Base::swap;
  384. // node_hash_map::rehash(count)
  385. //
  386. // Rehashes the `node_hash_map`, setting the number of slots to be at least
  387. // the passed value. If the new number of slots increases the load factor more
  388. // than the current maximum load factor
  389. // (`count` < `size()` / `max_load_factor()`), then the new number of slots
  390. // will be at least `size()` / `max_load_factor()`.
  391. //
  392. // To force a rehash, pass rehash(0).
  393. using Base::rehash;
  394. // node_hash_map::reserve(count)
  395. //
  396. // Sets the number of slots in the `node_hash_map` to the number needed to
  397. // accommodate at least `count` total elements without exceeding the current
  398. // maximum load factor, and may rehash the container if needed.
  399. using Base::reserve;
  400. // node_hash_map::at()
  401. //
  402. // Returns a reference to the mapped value of the element with key equivalent
  403. // to the passed key.
  404. using Base::at;
  405. // node_hash_map::contains()
  406. //
  407. // Determines whether an element with a key comparing equal to the given `key`
  408. // exists within the `node_hash_map`, returning `true` if so or `false`
  409. // otherwise.
  410. using Base::contains;
  411. // node_hash_map::count(const Key& key) const
  412. //
  413. // Returns the number of elements with a key comparing equal to the given
  414. // `key` within the `node_hash_map`. note that this function will return
  415. // either `1` or `0` since duplicate keys are not allowed within a
  416. // `node_hash_map`.
  417. using Base::count;
  418. // node_hash_map::equal_range()
  419. //
  420. // Returns a closed range [first, last], defined by a `std::pair` of two
  421. // iterators, containing all elements with the passed key in the
  422. // `node_hash_map`.
  423. using Base::equal_range;
  424. // node_hash_map::find()
  425. //
  426. // Finds an element with the passed `key` within the `node_hash_map`.
  427. using Base::find;
  428. // node_hash_map::operator[]()
  429. //
  430. // Returns a reference to the value mapped to the passed key within the
  431. // `node_hash_map`, performing an `insert()` if the key does not already
  432. // exist. If an insertion occurs and results in a rehashing of the container,
  433. // all iterators are invalidated. Otherwise iterators are not affected and
  434. // references are not invalidated. Overloads are listed below.
  435. //
  436. // T& operator[](const Key& key):
  437. //
  438. // Inserts an init_type object constructed in-place if the element with the
  439. // given key does not exist.
  440. //
  441. // T& operator[](Key&& key):
  442. //
  443. // Inserts an init_type object constructed in-place provided that an element
  444. // with the given key does not exist.
  445. using Base::operator[];
  446. // node_hash_map::bucket_count()
  447. //
  448. // Returns the number of "buckets" within the `node_hash_map`.
  449. using Base::bucket_count;
  450. // node_hash_map::load_factor()
  451. //
  452. // Returns the current load factor of the `node_hash_map` (the average number
  453. // of slots occupied with a value within the hash map).
  454. using Base::load_factor;
  455. // node_hash_map::max_load_factor()
  456. //
  457. // Manages the maximum load factor of the `node_hash_map`. Overloads are
  458. // listed below.
  459. //
  460. // float node_hash_map::max_load_factor()
  461. //
  462. // Returns the current maximum load factor of the `node_hash_map`.
  463. //
  464. // void node_hash_map::max_load_factor(float ml)
  465. //
  466. // Sets the maximum load factor of the `node_hash_map` to the passed value.
  467. //
  468. // NOTE: This overload is provided only for API compatibility with the STL;
  469. // `node_hash_map` will ignore any set load factor and manage its rehashing
  470. // internally as an implementation detail.
  471. using Base::max_load_factor;
  472. // node_hash_map::get_allocator()
  473. //
  474. // Returns the allocator function associated with this `node_hash_map`.
  475. using Base::get_allocator;
  476. // node_hash_map::hash_function()
  477. //
  478. // Returns the hashing function used to hash the keys within this
  479. // `node_hash_map`.
  480. using Base::hash_function;
  481. // node_hash_map::key_eq()
  482. //
  483. // Returns the function used for comparing keys equality.
  484. using Base::key_eq;
  485. };
  486. // erase_if(node_hash_map<>, Pred)
  487. //
  488. // Erases all elements that satisfy the predicate `pred` from the container `c`.
  489. template <typename K, typename V, typename H, typename E, typename A,
  490. typename Predicate>
  491. void erase_if(node_hash_map<K, V, H, E, A>& c, Predicate pred) {
  492. container_internal::EraseIf(pred, &c);
  493. }
  494. namespace container_internal {
  495. template <class Key, class Value>
  496. class NodeHashMapPolicy
  497. : public absl::container_internal::node_hash_policy<
  498. std::pair<const Key, Value>&, NodeHashMapPolicy<Key, Value>> {
  499. using value_type = std::pair<const Key, Value>;
  500. public:
  501. using key_type = Key;
  502. using mapped_type = Value;
  503. using init_type = std::pair</*non const*/ key_type, mapped_type>;
  504. template <class Allocator, class... Args>
  505. static value_type* new_element(Allocator* alloc, Args&&... args) {
  506. using PairAlloc = typename absl::allocator_traits<
  507. Allocator>::template rebind_alloc<value_type>;
  508. PairAlloc pair_alloc(*alloc);
  509. value_type* res =
  510. absl::allocator_traits<PairAlloc>::allocate(pair_alloc, 1);
  511. absl::allocator_traits<PairAlloc>::construct(pair_alloc, res,
  512. std::forward<Args>(args)...);
  513. return res;
  514. }
  515. template <class Allocator>
  516. static void delete_element(Allocator* alloc, value_type* pair) {
  517. using PairAlloc = typename absl::allocator_traits<
  518. Allocator>::template rebind_alloc<value_type>;
  519. PairAlloc pair_alloc(*alloc);
  520. absl::allocator_traits<PairAlloc>::destroy(pair_alloc, pair);
  521. absl::allocator_traits<PairAlloc>::deallocate(pair_alloc, pair, 1);
  522. }
  523. template <class F, class... Args>
  524. static decltype(absl::container_internal::DecomposePair(
  525. std::declval<F>(), std::declval<Args>()...))
  526. apply(F&& f, Args&&... args) {
  527. return absl::container_internal::DecomposePair(std::forward<F>(f),
  528. std::forward<Args>(args)...);
  529. }
  530. static size_t element_space_used(const value_type*) {
  531. return sizeof(value_type);
  532. }
  533. static Value& value(value_type* elem) { return elem->second; }
  534. static const Value& value(const value_type* elem) { return elem->second; }
  535. };
  536. } // namespace container_internal
  537. namespace container_algorithm_internal {
  538. // Specialization of trait in absl/algorithm/container.h
  539. template <class Key, class T, class Hash, class KeyEqual, class Allocator>
  540. struct IsUnorderedContainer<
  541. absl::node_hash_map<Key, T, Hash, KeyEqual, Allocator>> : std::true_type {};
  542. } // namespace container_algorithm_internal
  543. ABSL_NAMESPACE_END
  544. } // namespace absl
  545. #endif // ABSL_CONTAINER_NODE_HASH_MAP_H_