unordered_node_set.hpp 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711
  1. // Copyright (C) 2022-2023 Christian Mazakas
  2. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  3. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  4. #ifndef BOOST_UNORDERED_UNORDERED_NODE_SET_HPP_INCLUDED
  5. #define BOOST_UNORDERED_UNORDERED_NODE_SET_HPP_INCLUDED
  6. #include <boost/config.hpp>
  7. #if defined(BOOST_HAS_PRAGMA_ONCE)
  8. #pragma once
  9. #endif
  10. #include <boost/unordered/detail/foa/element_type.hpp>
  11. #include <boost/unordered/detail/foa/node_handle.hpp>
  12. #include <boost/unordered/detail/foa/node_set_types.hpp>
  13. #include <boost/unordered/detail/foa/table.hpp>
  14. #include <boost/unordered/detail/serialize_container.hpp>
  15. #include <boost/unordered/detail/type_traits.hpp>
  16. #include <boost/unordered/unordered_node_set_fwd.hpp>
  17. #include <boost/core/allocator_access.hpp>
  18. #include <boost/container_hash/hash.hpp>
  19. #include <boost/throw_exception.hpp>
  20. #include <initializer_list>
  21. #include <iterator>
  22. #include <type_traits>
  23. #include <utility>
  24. namespace boost {
  25. namespace unordered {
  26. #if defined(BOOST_MSVC)
  27. #pragma warning(push)
  28. #pragma warning(disable : 4714) /* marked as __forceinline not inlined */
  29. #endif
  30. namespace detail {
  31. template <class TypePolicy, class Allocator>
  32. struct node_set_handle
  33. : public detail::foa::node_handle_base<TypePolicy, Allocator>
  34. {
  35. private:
  36. using base_type = detail::foa::node_handle_base<TypePolicy, Allocator>;
  37. using typename base_type::type_policy;
  38. template <class Key, class Hash, class Pred, class Alloc>
  39. friend class boost::unordered::unordered_node_set;
  40. public:
  41. using value_type = typename TypePolicy::value_type;
  42. constexpr node_set_handle() noexcept = default;
  43. node_set_handle(node_set_handle&& nh) noexcept = default;
  44. node_set_handle& operator=(node_set_handle&&) noexcept = default;
  45. value_type& value() const
  46. {
  47. BOOST_ASSERT(!this->empty());
  48. return const_cast<value_type&>(this->data());
  49. }
  50. };
  51. } // namespace detail
  52. template <class Key, class Hash, class KeyEqual, class Allocator>
  53. class unordered_node_set
  54. {
  55. using set_types = detail::foa::node_set_types<Key,
  56. typename boost::allocator_void_pointer<Allocator>::type>;
  57. using table_type = detail::foa::table<set_types, Hash, KeyEqual,
  58. typename boost::allocator_rebind<Allocator,
  59. typename set_types::value_type>::type>;
  60. table_type table_;
  61. template <class K, class H, class KE, class A>
  62. bool friend operator==(unordered_node_set<K, H, KE, A> const& lhs,
  63. unordered_node_set<K, H, KE, A> const& rhs);
  64. template <class K, class H, class KE, class A, class Pred>
  65. typename unordered_node_set<K, H, KE, A>::size_type friend erase_if(
  66. unordered_node_set<K, H, KE, A>& set, Pred pred);
  67. public:
  68. using key_type = Key;
  69. using value_type = typename set_types::value_type;
  70. using init_type = typename set_types::init_type;
  71. using size_type = std::size_t;
  72. using difference_type = std::ptrdiff_t;
  73. using hasher = Hash;
  74. using key_equal = KeyEqual;
  75. using allocator_type = Allocator;
  76. using reference = value_type&;
  77. using const_reference = value_type const&;
  78. using pointer = typename boost::allocator_pointer<allocator_type>::type;
  79. using const_pointer =
  80. typename boost::allocator_const_pointer<allocator_type>::type;
  81. using iterator = typename table_type::iterator;
  82. using const_iterator = typename table_type::const_iterator;
  83. using node_type = detail::node_set_handle<set_types,
  84. typename boost::allocator_rebind<Allocator,
  85. typename set_types::value_type>::type>;
  86. using insert_return_type =
  87. detail::foa::insert_return_type<iterator, node_type>;
  88. #if defined(BOOST_UNORDERED_ENABLE_STATS)
  89. using stats = typename table_type::stats;
  90. #endif
  91. unordered_node_set() : unordered_node_set(0) {}
  92. explicit unordered_node_set(size_type n, hasher const& h = hasher(),
  93. key_equal const& pred = key_equal(),
  94. allocator_type const& a = allocator_type())
  95. : table_(n, h, pred, a)
  96. {
  97. }
  98. unordered_node_set(size_type n, allocator_type const& a)
  99. : unordered_node_set(n, hasher(), key_equal(), a)
  100. {
  101. }
  102. unordered_node_set(size_type n, hasher const& h, allocator_type const& a)
  103. : unordered_node_set(n, h, key_equal(), a)
  104. {
  105. }
  106. template <class InputIterator>
  107. unordered_node_set(
  108. InputIterator f, InputIterator l, allocator_type const& a)
  109. : unordered_node_set(f, l, size_type(0), hasher(), key_equal(), a)
  110. {
  111. }
  112. explicit unordered_node_set(allocator_type const& a)
  113. : unordered_node_set(0, a)
  114. {
  115. }
  116. template <class Iterator>
  117. unordered_node_set(Iterator first, Iterator last, size_type n = 0,
  118. hasher const& h = hasher(), key_equal const& pred = key_equal(),
  119. allocator_type const& a = allocator_type())
  120. : unordered_node_set(n, h, pred, a)
  121. {
  122. this->insert(first, last);
  123. }
  124. template <class InputIt>
  125. unordered_node_set(
  126. InputIt first, InputIt last, size_type n, allocator_type const& a)
  127. : unordered_node_set(first, last, n, hasher(), key_equal(), a)
  128. {
  129. }
  130. template <class Iterator>
  131. unordered_node_set(Iterator first, Iterator last, size_type n,
  132. hasher const& h, allocator_type const& a)
  133. : unordered_node_set(first, last, n, h, key_equal(), a)
  134. {
  135. }
  136. unordered_node_set(unordered_node_set const& other) : table_(other.table_)
  137. {
  138. }
  139. unordered_node_set(
  140. unordered_node_set const& other, allocator_type const& a)
  141. : table_(other.table_, a)
  142. {
  143. }
  144. unordered_node_set(unordered_node_set&& other)
  145. noexcept(std::is_nothrow_move_constructible<table_type>::value)
  146. : table_(std::move(other.table_))
  147. {
  148. }
  149. unordered_node_set(unordered_node_set&& other, allocator_type const& al)
  150. : table_(std::move(other.table_), al)
  151. {
  152. }
  153. unordered_node_set(std::initializer_list<value_type> ilist,
  154. size_type n = 0, hasher const& h = hasher(),
  155. key_equal const& pred = key_equal(),
  156. allocator_type const& a = allocator_type())
  157. : unordered_node_set(ilist.begin(), ilist.end(), n, h, pred, a)
  158. {
  159. }
  160. unordered_node_set(
  161. std::initializer_list<value_type> il, allocator_type const& a)
  162. : unordered_node_set(il, size_type(0), hasher(), key_equal(), a)
  163. {
  164. }
  165. unordered_node_set(std::initializer_list<value_type> init, size_type n,
  166. allocator_type const& a)
  167. : unordered_node_set(init, n, hasher(), key_equal(), a)
  168. {
  169. }
  170. unordered_node_set(std::initializer_list<value_type> init, size_type n,
  171. hasher const& h, allocator_type const& a)
  172. : unordered_node_set(init, n, h, key_equal(), a)
  173. {
  174. }
  175. ~unordered_node_set() = default;
  176. unordered_node_set& operator=(unordered_node_set const& other)
  177. {
  178. table_ = other.table_;
  179. return *this;
  180. }
  181. unordered_node_set& operator=(unordered_node_set&& other) noexcept(
  182. noexcept(std::declval<table_type&>() = std::declval<table_type&&>()))
  183. {
  184. table_ = std::move(other.table_);
  185. return *this;
  186. }
  187. allocator_type get_allocator() const noexcept
  188. {
  189. return table_.get_allocator();
  190. }
  191. /// Iterators
  192. ///
  193. iterator begin() noexcept { return table_.begin(); }
  194. const_iterator begin() const noexcept { return table_.begin(); }
  195. const_iterator cbegin() const noexcept { return table_.cbegin(); }
  196. iterator end() noexcept { return table_.end(); }
  197. const_iterator end() const noexcept { return table_.end(); }
  198. const_iterator cend() const noexcept { return table_.cend(); }
  199. /// Capacity
  200. ///
  201. BOOST_ATTRIBUTE_NODISCARD bool empty() const noexcept
  202. {
  203. return table_.empty();
  204. }
  205. size_type size() const noexcept { return table_.size(); }
  206. size_type max_size() const noexcept { return table_.max_size(); }
  207. /// Modifiers
  208. ///
  209. void clear() noexcept { table_.clear(); }
  210. BOOST_FORCEINLINE std::pair<iterator, bool> insert(
  211. value_type const& value)
  212. {
  213. return table_.insert(value);
  214. }
  215. BOOST_FORCEINLINE std::pair<iterator, bool> insert(value_type&& value)
  216. {
  217. return table_.insert(std::move(value));
  218. }
  219. template <class K>
  220. BOOST_FORCEINLINE typename std::enable_if<
  221. detail::transparent_non_iterable<K, unordered_node_set>::value,
  222. std::pair<iterator, bool> >::type
  223. insert(K&& k)
  224. {
  225. return table_.try_emplace(std::forward<K>(k));
  226. }
  227. BOOST_FORCEINLINE iterator insert(const_iterator, value_type const& value)
  228. {
  229. return table_.insert(value).first;
  230. }
  231. BOOST_FORCEINLINE iterator insert(const_iterator, value_type&& value)
  232. {
  233. return table_.insert(std::move(value)).first;
  234. }
  235. template <class K>
  236. BOOST_FORCEINLINE typename std::enable_if<
  237. detail::transparent_non_iterable<K, unordered_node_set>::value,
  238. iterator>::type
  239. insert(const_iterator, K&& k)
  240. {
  241. return table_.try_emplace(std::forward<K>(k)).first;
  242. }
  243. template <class InputIterator>
  244. void insert(InputIterator first, InputIterator last)
  245. {
  246. for (auto pos = first; pos != last; ++pos) {
  247. table_.emplace(*pos);
  248. }
  249. }
  250. void insert(std::initializer_list<value_type> ilist)
  251. {
  252. this->insert(ilist.begin(), ilist.end());
  253. }
  254. insert_return_type insert(node_type&& nh)
  255. {
  256. if (nh.empty()) {
  257. return {end(), false, node_type{}};
  258. }
  259. BOOST_ASSERT(get_allocator() == nh.get_allocator());
  260. auto itp = table_.insert(std::move(nh.element()));
  261. if (itp.second) {
  262. nh.reset();
  263. return {itp.first, true, node_type{}};
  264. } else {
  265. return {itp.first, false, std::move(nh)};
  266. }
  267. }
  268. iterator insert(const_iterator, node_type&& nh)
  269. {
  270. if (nh.empty()) {
  271. return end();
  272. }
  273. BOOST_ASSERT(get_allocator() == nh.get_allocator());
  274. auto itp = table_.insert(std::move(nh.element()));
  275. if (itp.second) {
  276. nh.reset();
  277. return itp.first;
  278. } else {
  279. return itp.first;
  280. }
  281. }
  282. template <class... Args>
  283. BOOST_FORCEINLINE std::pair<iterator, bool> emplace(Args&&... args)
  284. {
  285. return table_.emplace(std::forward<Args>(args)...);
  286. }
  287. template <class... Args>
  288. BOOST_FORCEINLINE iterator emplace_hint(const_iterator, Args&&... args)
  289. {
  290. return table_.emplace(std::forward<Args>(args)...).first;
  291. }
  292. BOOST_FORCEINLINE typename table_type::erase_return_type erase(
  293. const_iterator pos)
  294. {
  295. return table_.erase(pos);
  296. }
  297. iterator erase(const_iterator first, const_iterator last)
  298. {
  299. while (first != last) {
  300. this->erase(first++);
  301. }
  302. return iterator{detail::foa::const_iterator_cast_tag{}, last};
  303. }
  304. BOOST_FORCEINLINE size_type erase(key_type const& key)
  305. {
  306. return table_.erase(key);
  307. }
  308. template <class K>
  309. BOOST_FORCEINLINE typename std::enable_if<
  310. detail::transparent_non_iterable<K, unordered_node_set>::value,
  311. size_type>::type
  312. erase(K const& key)
  313. {
  314. return table_.erase(key);
  315. }
  316. void swap(unordered_node_set& rhs) noexcept(
  317. noexcept(std::declval<table_type&>().swap(std::declval<table_type&>())))
  318. {
  319. table_.swap(rhs.table_);
  320. }
  321. node_type extract(const_iterator pos)
  322. {
  323. BOOST_ASSERT(pos != end());
  324. node_type nh;
  325. auto elem = table_.extract(pos);
  326. nh.emplace(std::move(elem), get_allocator());
  327. return nh;
  328. }
  329. node_type extract(key_type const& key)
  330. {
  331. auto pos = find(key);
  332. return pos != end() ? extract(pos) : node_type();
  333. }
  334. template <class K>
  335. typename std::enable_if<
  336. boost::unordered::detail::transparent_non_iterable<K,
  337. unordered_node_set>::value,
  338. node_type>::type
  339. extract(K const& key)
  340. {
  341. auto pos = find(key);
  342. return pos != end() ? extract(pos) : node_type();
  343. }
  344. template <class H2, class P2>
  345. void merge(unordered_node_set<key_type, H2, P2, allocator_type>& source)
  346. {
  347. BOOST_ASSERT(get_allocator() == source.get_allocator());
  348. table_.merge(source.table_);
  349. }
  350. template <class H2, class P2>
  351. void merge(unordered_node_set<key_type, H2, P2, allocator_type>&& source)
  352. {
  353. BOOST_ASSERT(get_allocator() == source.get_allocator());
  354. table_.merge(std::move(source.table_));
  355. }
  356. /// Lookup
  357. ///
  358. BOOST_FORCEINLINE size_type count(key_type const& key) const
  359. {
  360. auto pos = table_.find(key);
  361. return pos != table_.end() ? 1 : 0;
  362. }
  363. template <class K>
  364. BOOST_FORCEINLINE typename std::enable_if<
  365. detail::are_transparent<K, hasher, key_equal>::value, size_type>::type
  366. count(K const& key) const
  367. {
  368. auto pos = table_.find(key);
  369. return pos != table_.end() ? 1 : 0;
  370. }
  371. BOOST_FORCEINLINE iterator find(key_type const& key)
  372. {
  373. return table_.find(key);
  374. }
  375. BOOST_FORCEINLINE const_iterator find(key_type const& key) const
  376. {
  377. return table_.find(key);
  378. }
  379. template <class K>
  380. BOOST_FORCEINLINE typename std::enable_if<
  381. boost::unordered::detail::are_transparent<K, hasher, key_equal>::value,
  382. iterator>::type
  383. find(K const& key)
  384. {
  385. return table_.find(key);
  386. }
  387. template <class K>
  388. BOOST_FORCEINLINE typename std::enable_if<
  389. boost::unordered::detail::are_transparent<K, hasher, key_equal>::value,
  390. const_iterator>::type
  391. find(K const& key) const
  392. {
  393. return table_.find(key);
  394. }
  395. BOOST_FORCEINLINE bool contains(key_type const& key) const
  396. {
  397. return this->find(key) != this->end();
  398. }
  399. template <class K>
  400. BOOST_FORCEINLINE typename std::enable_if<
  401. boost::unordered::detail::are_transparent<K, hasher, key_equal>::value,
  402. bool>::type
  403. contains(K const& key) const
  404. {
  405. return this->find(key) != this->end();
  406. }
  407. std::pair<iterator, iterator> equal_range(key_type const& key)
  408. {
  409. auto pos = table_.find(key);
  410. if (pos == table_.end()) {
  411. return {pos, pos};
  412. }
  413. auto next = pos;
  414. ++next;
  415. return {pos, next};
  416. }
  417. std::pair<const_iterator, const_iterator> equal_range(
  418. key_type const& key) const
  419. {
  420. auto pos = table_.find(key);
  421. if (pos == table_.end()) {
  422. return {pos, pos};
  423. }
  424. auto next = pos;
  425. ++next;
  426. return {pos, next};
  427. }
  428. template <class K>
  429. typename std::enable_if<
  430. detail::are_transparent<K, hasher, key_equal>::value,
  431. std::pair<iterator, iterator> >::type
  432. equal_range(K const& key)
  433. {
  434. auto pos = table_.find(key);
  435. if (pos == table_.end()) {
  436. return {pos, pos};
  437. }
  438. auto next = pos;
  439. ++next;
  440. return {pos, next};
  441. }
  442. template <class K>
  443. typename std::enable_if<
  444. detail::are_transparent<K, hasher, key_equal>::value,
  445. std::pair<const_iterator, const_iterator> >::type
  446. equal_range(K const& key) const
  447. {
  448. auto pos = table_.find(key);
  449. if (pos == table_.end()) {
  450. return {pos, pos};
  451. }
  452. auto next = pos;
  453. ++next;
  454. return {pos, next};
  455. }
  456. /// Hash Policy
  457. ///
  458. size_type bucket_count() const noexcept { return table_.capacity(); }
  459. float load_factor() const noexcept { return table_.load_factor(); }
  460. float max_load_factor() const noexcept
  461. {
  462. return table_.max_load_factor();
  463. }
  464. void max_load_factor(float) {}
  465. size_type max_load() const noexcept { return table_.max_load(); }
  466. void rehash(size_type n) { table_.rehash(n); }
  467. void reserve(size_type n) { table_.reserve(n); }
  468. #if defined(BOOST_UNORDERED_ENABLE_STATS)
  469. /// Stats
  470. ///
  471. stats get_stats() const { return table_.get_stats(); }
  472. void reset_stats() noexcept { table_.reset_stats(); }
  473. #endif
  474. /// Observers
  475. ///
  476. hasher hash_function() const { return table_.hash_function(); }
  477. key_equal key_eq() const { return table_.key_eq(); }
  478. };
  479. template <class Key, class Hash, class KeyEqual, class Allocator>
  480. bool operator==(
  481. unordered_node_set<Key, Hash, KeyEqual, Allocator> const& lhs,
  482. unordered_node_set<Key, Hash, KeyEqual, Allocator> const& rhs)
  483. {
  484. return lhs.table_ == rhs.table_;
  485. }
  486. template <class Key, class Hash, class KeyEqual, class Allocator>
  487. bool operator!=(
  488. unordered_node_set<Key, Hash, KeyEqual, Allocator> const& lhs,
  489. unordered_node_set<Key, Hash, KeyEqual, Allocator> const& rhs)
  490. {
  491. return !(lhs == rhs);
  492. }
  493. template <class Key, class Hash, class KeyEqual, class Allocator>
  494. void swap(unordered_node_set<Key, Hash, KeyEqual, Allocator>& lhs,
  495. unordered_node_set<Key, Hash, KeyEqual, Allocator>& rhs)
  496. noexcept(noexcept(lhs.swap(rhs)))
  497. {
  498. lhs.swap(rhs);
  499. }
  500. template <class Key, class Hash, class KeyEqual, class Allocator,
  501. class Pred>
  502. typename unordered_node_set<Key, Hash, KeyEqual, Allocator>::size_type
  503. erase_if(unordered_node_set<Key, Hash, KeyEqual, Allocator>& set, Pred pred)
  504. {
  505. return erase_if(set.table_, pred);
  506. }
  507. template <class Archive, class Key, class Hash, class KeyEqual,
  508. class Allocator>
  509. void serialize(Archive& ar,
  510. unordered_node_set<Key, Hash, KeyEqual, Allocator>& set,
  511. unsigned int version)
  512. {
  513. detail::serialize_container(ar, set, version);
  514. }
  515. #if defined(BOOST_MSVC)
  516. #pragma warning(pop) /* C4714 */
  517. #endif
  518. #if BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES
  519. template <class InputIterator,
  520. class Hash =
  521. boost::hash<typename std::iterator_traits<InputIterator>::value_type>,
  522. class Pred =
  523. std::equal_to<typename std::iterator_traits<InputIterator>::value_type>,
  524. class Allocator = std::allocator<
  525. typename std::iterator_traits<InputIterator>::value_type>,
  526. class = std::enable_if_t<detail::is_input_iterator_v<InputIterator> >,
  527. class = std::enable_if_t<detail::is_hash_v<Hash> >,
  528. class = std::enable_if_t<detail::is_pred_v<Pred> >,
  529. class = std::enable_if_t<detail::is_allocator_v<Allocator> > >
  530. unordered_node_set(InputIterator, InputIterator,
  531. std::size_t = boost::unordered::detail::foa::default_bucket_count,
  532. Hash = Hash(), Pred = Pred(), Allocator = Allocator())
  533. -> unordered_node_set<
  534. typename std::iterator_traits<InputIterator>::value_type, Hash, Pred,
  535. Allocator>;
  536. template <class T, class Hash = boost::hash<T>,
  537. class Pred = std::equal_to<T>, class Allocator = std::allocator<T>,
  538. class = std::enable_if_t<detail::is_hash_v<Hash> >,
  539. class = std::enable_if_t<detail::is_pred_v<Pred> >,
  540. class = std::enable_if_t<detail::is_allocator_v<Allocator> > >
  541. unordered_node_set(std::initializer_list<T>,
  542. std::size_t = boost::unordered::detail::foa::default_bucket_count,
  543. Hash = Hash(), Pred = Pred(), Allocator = Allocator())
  544. -> unordered_node_set<T, Hash, Pred, Allocator>;
  545. template <class InputIterator, class Allocator,
  546. class = std::enable_if_t<detail::is_input_iterator_v<InputIterator> >,
  547. class = std::enable_if_t<detail::is_allocator_v<Allocator> > >
  548. unordered_node_set(InputIterator, InputIterator, std::size_t, Allocator)
  549. -> unordered_node_set<
  550. typename std::iterator_traits<InputIterator>::value_type,
  551. boost::hash<typename std::iterator_traits<InputIterator>::value_type>,
  552. std::equal_to<typename std::iterator_traits<InputIterator>::value_type>,
  553. Allocator>;
  554. template <class InputIterator, class Hash, class Allocator,
  555. class = std::enable_if_t<detail::is_hash_v<Hash> >,
  556. class = std::enable_if_t<detail::is_input_iterator_v<InputIterator> >,
  557. class = std::enable_if_t<detail::is_allocator_v<Allocator> > >
  558. unordered_node_set(
  559. InputIterator, InputIterator, std::size_t, Hash, Allocator)
  560. -> unordered_node_set<
  561. typename std::iterator_traits<InputIterator>::value_type, Hash,
  562. std::equal_to<typename std::iterator_traits<InputIterator>::value_type>,
  563. Allocator>;
  564. template <class T, class Allocator,
  565. class = std::enable_if_t<detail::is_allocator_v<Allocator> > >
  566. unordered_node_set(std::initializer_list<T>, std::size_t, Allocator)
  567. -> unordered_node_set<T, boost::hash<T>, std::equal_to<T>, Allocator>;
  568. template <class T, class Hash, class Allocator,
  569. class = std::enable_if_t<detail::is_hash_v<Hash> >,
  570. class = std::enable_if_t<detail::is_allocator_v<Allocator> > >
  571. unordered_node_set(std::initializer_list<T>, std::size_t, Hash, Allocator)
  572. -> unordered_node_set<T, Hash, std::equal_to<T>, Allocator>;
  573. template <class InputIterator, class Allocator,
  574. class = std::enable_if_t<detail::is_input_iterator_v<InputIterator> >,
  575. class = std::enable_if_t<detail::is_allocator_v<Allocator> > >
  576. unordered_node_set(InputIterator, InputIterator, Allocator)
  577. -> unordered_node_set<
  578. typename std::iterator_traits<InputIterator>::value_type,
  579. boost::hash<typename std::iterator_traits<InputIterator>::value_type>,
  580. std::equal_to<typename std::iterator_traits<InputIterator>::value_type>,
  581. Allocator>;
  582. template <class T, class Allocator,
  583. class = std::enable_if_t<detail::is_allocator_v<Allocator> > >
  584. unordered_node_set(std::initializer_list<T>, Allocator)
  585. -> unordered_node_set<T, boost::hash<T>, std::equal_to<T>, Allocator>;
  586. #endif
  587. } // namespace unordered
  588. } // namespace boost
  589. #endif