10b57cec5SDimitry Andric// -*- C++ -*- 2349cc55cSDimitry Andric//===----------------------------------------------------------------------===// 30b57cec5SDimitry Andric// 40b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 50b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 60b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 70b57cec5SDimitry Andric// 80b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 90b57cec5SDimitry Andric 100b57cec5SDimitry Andric#ifndef _LIBCPP_UNORDERED_SET 110b57cec5SDimitry Andric#define _LIBCPP_UNORDERED_SET 120b57cec5SDimitry Andric 130b57cec5SDimitry Andric/* 140b57cec5SDimitry Andric 150b57cec5SDimitry Andric unordered_set synopsis 160b57cec5SDimitry Andric 170b57cec5SDimitry Andric#include <initializer_list> 180b57cec5SDimitry Andric 190b57cec5SDimitry Andricnamespace std 200b57cec5SDimitry Andric{ 210b57cec5SDimitry Andric 220b57cec5SDimitry Andrictemplate <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, 230b57cec5SDimitry Andric class Alloc = allocator<Value>> 240b57cec5SDimitry Andricclass unordered_set 250b57cec5SDimitry Andric{ 260b57cec5SDimitry Andricpublic: 270b57cec5SDimitry Andric // types 280b57cec5SDimitry Andric typedef Value key_type; 290b57cec5SDimitry Andric typedef key_type value_type; 300b57cec5SDimitry Andric typedef Hash hasher; 310b57cec5SDimitry Andric typedef Pred key_equal; 320b57cec5SDimitry Andric typedef Alloc allocator_type; 330b57cec5SDimitry Andric typedef value_type& reference; 340b57cec5SDimitry Andric typedef const value_type& const_reference; 350b57cec5SDimitry Andric typedef typename allocator_traits<allocator_type>::pointer pointer; 360b57cec5SDimitry Andric typedef typename allocator_traits<allocator_type>::const_pointer const_pointer; 370b57cec5SDimitry Andric typedef typename allocator_traits<allocator_type>::size_type size_type; 380b57cec5SDimitry Andric typedef typename allocator_traits<allocator_type>::difference_type difference_type; 390b57cec5SDimitry Andric 400b57cec5SDimitry Andric typedef /unspecified/ iterator; 410b57cec5SDimitry Andric typedef /unspecified/ const_iterator; 420b57cec5SDimitry Andric typedef /unspecified/ local_iterator; 430b57cec5SDimitry Andric typedef /unspecified/ const_local_iterator; 440b57cec5SDimitry Andric 450b57cec5SDimitry Andric typedef unspecified node_type unspecified; // C++17 460b57cec5SDimitry Andric typedef INSERT_RETURN_TYPE<iterator, node_type> insert_return_type; // C++17 470b57cec5SDimitry Andric 480b57cec5SDimitry Andric unordered_set() 490b57cec5SDimitry Andric noexcept( 500b57cec5SDimitry Andric is_nothrow_default_constructible<hasher>::value && 510b57cec5SDimitry Andric is_nothrow_default_constructible<key_equal>::value && 520b57cec5SDimitry Andric is_nothrow_default_constructible<allocator_type>::value); 530b57cec5SDimitry Andric explicit unordered_set(size_type n, const hasher& hf = hasher(), 540b57cec5SDimitry Andric const key_equal& eql = key_equal(), 550b57cec5SDimitry Andric const allocator_type& a = allocator_type()); 560b57cec5SDimitry Andric template <class InputIterator> 570b57cec5SDimitry Andric unordered_set(InputIterator f, InputIterator l, 580b57cec5SDimitry Andric size_type n = 0, const hasher& hf = hasher(), 590b57cec5SDimitry Andric const key_equal& eql = key_equal(), 600b57cec5SDimitry Andric const allocator_type& a = allocator_type()); 610b57cec5SDimitry Andric explicit unordered_set(const allocator_type&); 620b57cec5SDimitry Andric unordered_set(const unordered_set&); 630b57cec5SDimitry Andric unordered_set(const unordered_set&, const Allocator&); 640b57cec5SDimitry Andric unordered_set(unordered_set&&) 650b57cec5SDimitry Andric noexcept( 660b57cec5SDimitry Andric is_nothrow_move_constructible<hasher>::value && 670b57cec5SDimitry Andric is_nothrow_move_constructible<key_equal>::value && 680b57cec5SDimitry Andric is_nothrow_move_constructible<allocator_type>::value); 690b57cec5SDimitry Andric unordered_set(unordered_set&&, const Allocator&); 700b57cec5SDimitry Andric unordered_set(initializer_list<value_type>, size_type n = 0, 710b57cec5SDimitry Andric const hasher& hf = hasher(), const key_equal& eql = key_equal(), 720b57cec5SDimitry Andric const allocator_type& a = allocator_type()); 730b57cec5SDimitry Andric unordered_set(size_type n, const allocator_type& a); // C++14 740b57cec5SDimitry Andric unordered_set(size_type n, const hasher& hf, const allocator_type& a); // C++14 750b57cec5SDimitry Andric template <class InputIterator> 760b57cec5SDimitry Andric unordered_set(InputIterator f, InputIterator l, size_type n, const allocator_type& a); // C++14 770b57cec5SDimitry Andric template <class InputIterator> 780b57cec5SDimitry Andric unordered_set(InputIterator f, InputIterator l, size_type n, 790b57cec5SDimitry Andric const hasher& hf, const allocator_type& a); // C++14 800b57cec5SDimitry Andric unordered_set(initializer_list<value_type> il, size_type n, const allocator_type& a); // C++14 810b57cec5SDimitry Andric unordered_set(initializer_list<value_type> il, size_type n, 820b57cec5SDimitry Andric const hasher& hf, const allocator_type& a); // C++14 830b57cec5SDimitry Andric ~unordered_set(); 840b57cec5SDimitry Andric unordered_set& operator=(const unordered_set&); 850b57cec5SDimitry Andric unordered_set& operator=(unordered_set&&) 860b57cec5SDimitry Andric noexcept( 870b57cec5SDimitry Andric allocator_type::propagate_on_container_move_assignment::value && 880b57cec5SDimitry Andric is_nothrow_move_assignable<allocator_type>::value && 890b57cec5SDimitry Andric is_nothrow_move_assignable<hasher>::value && 900b57cec5SDimitry Andric is_nothrow_move_assignable<key_equal>::value); 910b57cec5SDimitry Andric unordered_set& operator=(initializer_list<value_type>); 920b57cec5SDimitry Andric 930b57cec5SDimitry Andric allocator_type get_allocator() const noexcept; 940b57cec5SDimitry Andric 950b57cec5SDimitry Andric bool empty() const noexcept; 960b57cec5SDimitry Andric size_type size() const noexcept; 970b57cec5SDimitry Andric size_type max_size() const noexcept; 980b57cec5SDimitry Andric 990b57cec5SDimitry Andric iterator begin() noexcept; 1000b57cec5SDimitry Andric iterator end() noexcept; 1010b57cec5SDimitry Andric const_iterator begin() const noexcept; 1020b57cec5SDimitry Andric const_iterator end() const noexcept; 1030b57cec5SDimitry Andric const_iterator cbegin() const noexcept; 1040b57cec5SDimitry Andric const_iterator cend() const noexcept; 1050b57cec5SDimitry Andric 1060b57cec5SDimitry Andric template <class... Args> 1070b57cec5SDimitry Andric pair<iterator, bool> emplace(Args&&... args); 1080b57cec5SDimitry Andric template <class... Args> 1090b57cec5SDimitry Andric iterator emplace_hint(const_iterator position, Args&&... args); 1100b57cec5SDimitry Andric pair<iterator, bool> insert(const value_type& obj); 1110b57cec5SDimitry Andric pair<iterator, bool> insert(value_type&& obj); 1120b57cec5SDimitry Andric iterator insert(const_iterator hint, const value_type& obj); 1130b57cec5SDimitry Andric iterator insert(const_iterator hint, value_type&& obj); 1140b57cec5SDimitry Andric template <class InputIterator> 1150b57cec5SDimitry Andric void insert(InputIterator first, InputIterator last); 1160b57cec5SDimitry Andric void insert(initializer_list<value_type>); 1170b57cec5SDimitry Andric 1180b57cec5SDimitry Andric node_type extract(const_iterator position); // C++17 1190b57cec5SDimitry Andric node_type extract(const key_type& x); // C++17 1200b57cec5SDimitry Andric insert_return_type insert(node_type&& nh); // C++17 1210b57cec5SDimitry Andric iterator insert(const_iterator hint, node_type&& nh); // C++17 1220b57cec5SDimitry Andric 1230b57cec5SDimitry Andric iterator erase(const_iterator position); 1240b57cec5SDimitry Andric iterator erase(iterator position); // C++14 1250b57cec5SDimitry Andric size_type erase(const key_type& k); 1260b57cec5SDimitry Andric iterator erase(const_iterator first, const_iterator last); 1270b57cec5SDimitry Andric void clear() noexcept; 1280b57cec5SDimitry Andric 1290b57cec5SDimitry Andric template<class H2, class P2> 1300b57cec5SDimitry Andric void merge(unordered_set<Key, H2, P2, Allocator>& source); // C++17 1310b57cec5SDimitry Andric template<class H2, class P2> 1320b57cec5SDimitry Andric void merge(unordered_set<Key, H2, P2, Allocator>&& source); // C++17 1330b57cec5SDimitry Andric template<class H2, class P2> 1340b57cec5SDimitry Andric void merge(unordered_multiset<Key, H2, P2, Allocator>& source); // C++17 1350b57cec5SDimitry Andric template<class H2, class P2> 1360b57cec5SDimitry Andric void merge(unordered_multiset<Key, H2, P2, Allocator>&& source); // C++17 1370b57cec5SDimitry Andric 1380b57cec5SDimitry Andric void swap(unordered_set&) 1390b57cec5SDimitry Andric noexcept(allocator_traits<Allocator>::is_always_equal::value && 1400b57cec5SDimitry Andric noexcept(swap(declval<hasher&>(), declval<hasher&>())) && 1410b57cec5SDimitry Andric noexcept(swap(declval<key_equal&>(), declval<key_equal&>()))); // C++17 1420b57cec5SDimitry Andric 1430b57cec5SDimitry Andric hasher hash_function() const; 1440b57cec5SDimitry Andric key_equal key_eq() const; 1450b57cec5SDimitry Andric 1460b57cec5SDimitry Andric iterator find(const key_type& k); 1470b57cec5SDimitry Andric const_iterator find(const key_type& k) const; 148e8d8bef9SDimitry Andric template<typename K> 149e8d8bef9SDimitry Andric iterator find(const K& x); // C++20 150e8d8bef9SDimitry Andric template<typename K> 151e8d8bef9SDimitry Andric const_iterator find(const K& x) const; // C++20 1520b57cec5SDimitry Andric size_type count(const key_type& k) const; 153e8d8bef9SDimitry Andric template<typename K> 154e8d8bef9SDimitry Andric size_type count(const K& k) const; // C++20 1550b57cec5SDimitry Andric bool contains(const key_type& k) const; // C++20 156e8d8bef9SDimitry Andric template<typename K> 157e8d8bef9SDimitry Andric bool contains(const K& k) const; // C++20 1580b57cec5SDimitry Andric pair<iterator, iterator> equal_range(const key_type& k); 1590b57cec5SDimitry Andric pair<const_iterator, const_iterator> equal_range(const key_type& k) const; 160e8d8bef9SDimitry Andric template<typename K> 161e8d8bef9SDimitry Andric pair<iterator, iterator> equal_range(const K& k); // C++20 162e8d8bef9SDimitry Andric template<typename K> 163e8d8bef9SDimitry Andric pair<const_iterator, const_iterator> equal_range(const K& k) const; // C++20 1640b57cec5SDimitry Andric 1650b57cec5SDimitry Andric size_type bucket_count() const noexcept; 1660b57cec5SDimitry Andric size_type max_bucket_count() const noexcept; 1670b57cec5SDimitry Andric 1680b57cec5SDimitry Andric size_type bucket_size(size_type n) const; 1690b57cec5SDimitry Andric size_type bucket(const key_type& k) const; 1700b57cec5SDimitry Andric 1710b57cec5SDimitry Andric local_iterator begin(size_type n); 1720b57cec5SDimitry Andric local_iterator end(size_type n); 1730b57cec5SDimitry Andric const_local_iterator begin(size_type n) const; 1740b57cec5SDimitry Andric const_local_iterator end(size_type n) const; 1750b57cec5SDimitry Andric const_local_iterator cbegin(size_type n) const; 1760b57cec5SDimitry Andric const_local_iterator cend(size_type n) const; 1770b57cec5SDimitry Andric 1780b57cec5SDimitry Andric float load_factor() const noexcept; 1790b57cec5SDimitry Andric float max_load_factor() const noexcept; 1800b57cec5SDimitry Andric void max_load_factor(float z); 1810b57cec5SDimitry Andric void rehash(size_type n); 1820b57cec5SDimitry Andric void reserve(size_type n); 1830b57cec5SDimitry Andric}; 1840b57cec5SDimitry Andric 185349cc55cSDimitry Andrictemplate<class InputIterator, 186349cc55cSDimitry Andric class Hash = hash<typename iterator_traits<InputIterator>::value_type>, 187349cc55cSDimitry Andric class Pred = equal_to<typename iterator_traits<InputIterator>::value_type>, 188349cc55cSDimitry Andric class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>> 189349cc55cSDimitry Andricunordered_set(InputIterator, InputIterator, typename see below::size_type = see below, 190349cc55cSDimitry Andric Hash = Hash(), Pred = Pred(), Allocator = Allocator()) 191349cc55cSDimitry Andric -> unordered_set<typename iterator_traits<InputIterator>::value_type, 192349cc55cSDimitry Andric Hash, Pred, Allocator>; // C++17 193349cc55cSDimitry Andric 194349cc55cSDimitry Andrictemplate<class T, class Hash = hash<T>, 195349cc55cSDimitry Andric class Pred = equal_to<T>, class Allocator = allocator<T>> 196349cc55cSDimitry Andricunordered_set(initializer_list<T>, typename see below::size_type = see below, 197349cc55cSDimitry Andric Hash = Hash(), Pred = Pred(), Allocator = Allocator()) 198349cc55cSDimitry Andric -> unordered_set<T, Hash, Pred, Allocator>; // C++17 199349cc55cSDimitry Andric 200349cc55cSDimitry Andrictemplate<class InputIterator, class Allocator> 201349cc55cSDimitry Andricunordered_set(InputIterator, InputIterator, typename see below::size_type, Allocator) 202349cc55cSDimitry Andric -> unordered_set<typename iterator_traits<InputIterator>::value_type, 203349cc55cSDimitry Andric hash<typename iterator_traits<InputIterator>::value_type>, 204349cc55cSDimitry Andric equal_to<typename iterator_traits<InputIterator>::value_type>, 205349cc55cSDimitry Andric Allocator>; // C++17 206349cc55cSDimitry Andric 207349cc55cSDimitry Andrictemplate<class InputIterator, class Hash, class Allocator> 208349cc55cSDimitry Andricunordered_set(InputIterator, InputIterator, typename see below::size_type, 209349cc55cSDimitry Andric Hash, Allocator) 210349cc55cSDimitry Andric -> unordered_set<typename iterator_traits<InputIterator>::value_type, Hash, 211349cc55cSDimitry Andric equal_to<typename iterator_traits<InputIterator>::value_type>, 212349cc55cSDimitry Andric Allocator>; // C++17 213349cc55cSDimitry Andric 214349cc55cSDimitry Andrictemplate<class T, class Allocator> 215349cc55cSDimitry Andricunordered_set(initializer_list<T>, typename see below::size_type, Allocator) 216349cc55cSDimitry Andric -> unordered_set<T, hash<T>, equal_to<T>, Allocator>; // C++17 217349cc55cSDimitry Andric 218349cc55cSDimitry Andrictemplate<class T, class Hash, class Allocator> 219349cc55cSDimitry Andricunordered_set(initializer_list<T>, typename see below::size_type, Hash, Allocator) 220349cc55cSDimitry Andric -> unordered_set<T, Hash, equal_to<T>, Allocator>; // C++17 221349cc55cSDimitry Andric 2220b57cec5SDimitry Andrictemplate <class Value, class Hash, class Pred, class Alloc> 2230b57cec5SDimitry Andric void swap(unordered_set<Value, Hash, Pred, Alloc>& x, 2240b57cec5SDimitry Andric unordered_set<Value, Hash, Pred, Alloc>& y) 2250b57cec5SDimitry Andric noexcept(noexcept(x.swap(y))); 2260b57cec5SDimitry Andric 2270b57cec5SDimitry Andrictemplate <class Value, class Hash, class Pred, class Alloc> 2280b57cec5SDimitry Andric bool 2290b57cec5SDimitry Andric operator==(const unordered_set<Value, Hash, Pred, Alloc>& x, 2300b57cec5SDimitry Andric const unordered_set<Value, Hash, Pred, Alloc>& y); 2310b57cec5SDimitry Andric 2320b57cec5SDimitry Andrictemplate <class Value, class Hash, class Pred, class Alloc> 2330b57cec5SDimitry Andric bool 2340b57cec5SDimitry Andric operator!=(const unordered_set<Value, Hash, Pred, Alloc>& x, 2350b57cec5SDimitry Andric const unordered_set<Value, Hash, Pred, Alloc>& y); 2360b57cec5SDimitry Andric 2370b57cec5SDimitry Andrictemplate <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, 2380b57cec5SDimitry Andric class Alloc = allocator<Value>> 2390b57cec5SDimitry Andricclass unordered_multiset 2400b57cec5SDimitry Andric{ 2410b57cec5SDimitry Andricpublic: 2420b57cec5SDimitry Andric // types 2430b57cec5SDimitry Andric typedef Value key_type; 2440b57cec5SDimitry Andric typedef key_type value_type; 2450b57cec5SDimitry Andric typedef Hash hasher; 2460b57cec5SDimitry Andric typedef Pred key_equal; 2470b57cec5SDimitry Andric typedef Alloc allocator_type; 2480b57cec5SDimitry Andric typedef value_type& reference; 2490b57cec5SDimitry Andric typedef const value_type& const_reference; 2500b57cec5SDimitry Andric typedef typename allocator_traits<allocator_type>::pointer pointer; 2510b57cec5SDimitry Andric typedef typename allocator_traits<allocator_type>::const_pointer const_pointer; 2520b57cec5SDimitry Andric typedef typename allocator_traits<allocator_type>::size_type size_type; 2530b57cec5SDimitry Andric typedef typename allocator_traits<allocator_type>::difference_type difference_type; 2540b57cec5SDimitry Andric 2550b57cec5SDimitry Andric typedef /unspecified/ iterator; 2560b57cec5SDimitry Andric typedef /unspecified/ const_iterator; 2570b57cec5SDimitry Andric typedef /unspecified/ local_iterator; 2580b57cec5SDimitry Andric typedef /unspecified/ const_local_iterator; 2590b57cec5SDimitry Andric 2600b57cec5SDimitry Andric typedef unspecified node_type unspecified; // C++17 2610b57cec5SDimitry Andric 2620b57cec5SDimitry Andric unordered_multiset() 2630b57cec5SDimitry Andric noexcept( 2640b57cec5SDimitry Andric is_nothrow_default_constructible<hasher>::value && 2650b57cec5SDimitry Andric is_nothrow_default_constructible<key_equal>::value && 2660b57cec5SDimitry Andric is_nothrow_default_constructible<allocator_type>::value); 2670b57cec5SDimitry Andric explicit unordered_multiset(size_type n, const hasher& hf = hasher(), 2680b57cec5SDimitry Andric const key_equal& eql = key_equal(), 2690b57cec5SDimitry Andric const allocator_type& a = allocator_type()); 2700b57cec5SDimitry Andric template <class InputIterator> 2710b57cec5SDimitry Andric unordered_multiset(InputIterator f, InputIterator l, 2720b57cec5SDimitry Andric size_type n = 0, const hasher& hf = hasher(), 2730b57cec5SDimitry Andric const key_equal& eql = key_equal(), 2740b57cec5SDimitry Andric const allocator_type& a = allocator_type()); 2750b57cec5SDimitry Andric explicit unordered_multiset(const allocator_type&); 2760b57cec5SDimitry Andric unordered_multiset(const unordered_multiset&); 2770b57cec5SDimitry Andric unordered_multiset(const unordered_multiset&, const Allocator&); 2780b57cec5SDimitry Andric unordered_multiset(unordered_multiset&&) 2790b57cec5SDimitry Andric noexcept( 2800b57cec5SDimitry Andric is_nothrow_move_constructible<hasher>::value && 2810b57cec5SDimitry Andric is_nothrow_move_constructible<key_equal>::value && 2820b57cec5SDimitry Andric is_nothrow_move_constructible<allocator_type>::value); 2830b57cec5SDimitry Andric unordered_multiset(unordered_multiset&&, const Allocator&); 2840b57cec5SDimitry Andric unordered_multiset(initializer_list<value_type>, size_type n = /see below/, 2850b57cec5SDimitry Andric const hasher& hf = hasher(), const key_equal& eql = key_equal(), 2860b57cec5SDimitry Andric const allocator_type& a = allocator_type()); 2870b57cec5SDimitry Andric unordered_multiset(size_type n, const allocator_type& a); // C++14 2880b57cec5SDimitry Andric unordered_multiset(size_type n, const hasher& hf, const allocator_type& a); // C++14 2890b57cec5SDimitry Andric template <class InputIterator> 2900b57cec5SDimitry Andric unordered_multiset(InputIterator f, InputIterator l, size_type n, const allocator_type& a); // C++14 2910b57cec5SDimitry Andric template <class InputIterator> 2920b57cec5SDimitry Andric unordered_multiset(InputIterator f, InputIterator l, size_type n, 2930b57cec5SDimitry Andric const hasher& hf, const allocator_type& a); // C++14 2940b57cec5SDimitry Andric unordered_multiset(initializer_list<value_type> il, size_type n, const allocator_type& a); // C++14 2950b57cec5SDimitry Andric unordered_multiset(initializer_list<value_type> il, size_type n, 2960b57cec5SDimitry Andric const hasher& hf, const allocator_type& a); // C++14 2970b57cec5SDimitry Andric ~unordered_multiset(); 2980b57cec5SDimitry Andric unordered_multiset& operator=(const unordered_multiset&); 2990b57cec5SDimitry Andric unordered_multiset& operator=(unordered_multiset&&) 3000b57cec5SDimitry Andric noexcept( 3010b57cec5SDimitry Andric allocator_type::propagate_on_container_move_assignment::value && 3020b57cec5SDimitry Andric is_nothrow_move_assignable<allocator_type>::value && 3030b57cec5SDimitry Andric is_nothrow_move_assignable<hasher>::value && 3040b57cec5SDimitry Andric is_nothrow_move_assignable<key_equal>::value); 3050b57cec5SDimitry Andric unordered_multiset& operator=(initializer_list<value_type>); 3060b57cec5SDimitry Andric 3070b57cec5SDimitry Andric allocator_type get_allocator() const noexcept; 3080b57cec5SDimitry Andric 3090b57cec5SDimitry Andric bool empty() const noexcept; 3100b57cec5SDimitry Andric size_type size() const noexcept; 3110b57cec5SDimitry Andric size_type max_size() const noexcept; 3120b57cec5SDimitry Andric 3130b57cec5SDimitry Andric iterator begin() noexcept; 3140b57cec5SDimitry Andric iterator end() noexcept; 3150b57cec5SDimitry Andric const_iterator begin() const noexcept; 3160b57cec5SDimitry Andric const_iterator end() const noexcept; 3170b57cec5SDimitry Andric const_iterator cbegin() const noexcept; 3180b57cec5SDimitry Andric const_iterator cend() const noexcept; 3190b57cec5SDimitry Andric 3200b57cec5SDimitry Andric template <class... Args> 3210b57cec5SDimitry Andric iterator emplace(Args&&... args); 3220b57cec5SDimitry Andric template <class... Args> 3230b57cec5SDimitry Andric iterator emplace_hint(const_iterator position, Args&&... args); 3240b57cec5SDimitry Andric iterator insert(const value_type& obj); 3250b57cec5SDimitry Andric iterator insert(value_type&& obj); 3260b57cec5SDimitry Andric iterator insert(const_iterator hint, const value_type& obj); 3270b57cec5SDimitry Andric iterator insert(const_iterator hint, value_type&& obj); 3280b57cec5SDimitry Andric template <class InputIterator> 3290b57cec5SDimitry Andric void insert(InputIterator first, InputIterator last); 3300b57cec5SDimitry Andric void insert(initializer_list<value_type>); 3310b57cec5SDimitry Andric 3320b57cec5SDimitry Andric node_type extract(const_iterator position); // C++17 3330b57cec5SDimitry Andric node_type extract(const key_type& x); // C++17 3340b57cec5SDimitry Andric iterator insert(node_type&& nh); // C++17 3350b57cec5SDimitry Andric iterator insert(const_iterator hint, node_type&& nh); // C++17 3360b57cec5SDimitry Andric 3370b57cec5SDimitry Andric iterator erase(const_iterator position); 3380b57cec5SDimitry Andric iterator erase(iterator position); // C++14 3390b57cec5SDimitry Andric size_type erase(const key_type& k); 3400b57cec5SDimitry Andric iterator erase(const_iterator first, const_iterator last); 3410b57cec5SDimitry Andric void clear() noexcept; 3420b57cec5SDimitry Andric 3430b57cec5SDimitry Andric template<class H2, class P2> 3440b57cec5SDimitry Andric void merge(unordered_multiset<Key, H2, P2, Allocator>& source); // C++17 3450b57cec5SDimitry Andric template<class H2, class P2> 3460b57cec5SDimitry Andric void merge(unordered_multiset<Key, H2, P2, Allocator>&& source); // C++17 3470b57cec5SDimitry Andric template<class H2, class P2> 3480b57cec5SDimitry Andric void merge(unordered_set<Key, H2, P2, Allocator>& source); // C++17 3490b57cec5SDimitry Andric template<class H2, class P2> 3500b57cec5SDimitry Andric void merge(unordered_set<Key, H2, P2, Allocator>&& source); // C++17 3510b57cec5SDimitry Andric 3520b57cec5SDimitry Andric void swap(unordered_multiset&) 3530b57cec5SDimitry Andric noexcept(allocator_traits<Allocator>::is_always_equal::value && 3540b57cec5SDimitry Andric noexcept(swap(declval<hasher&>(), declval<hasher&>())) && 3550b57cec5SDimitry Andric noexcept(swap(declval<key_equal&>(), declval<key_equal&>()))); // C++17 3560b57cec5SDimitry Andric 3570b57cec5SDimitry Andric hasher hash_function() const; 3580b57cec5SDimitry Andric key_equal key_eq() const; 3590b57cec5SDimitry Andric 3600b57cec5SDimitry Andric iterator find(const key_type& k); 3610b57cec5SDimitry Andric const_iterator find(const key_type& k) const; 362e8d8bef9SDimitry Andric template<typename K> 363e8d8bef9SDimitry Andric iterator find(const K& x); // C++20 364e8d8bef9SDimitry Andric template<typename K> 365e8d8bef9SDimitry Andric const_iterator find(const K& x) const; // C++20 3660b57cec5SDimitry Andric size_type count(const key_type& k) const; 367e8d8bef9SDimitry Andric template<typename K> 368e8d8bef9SDimitry Andric size_type count(const K& k) const; // C++20 3690b57cec5SDimitry Andric bool contains(const key_type& k) const; // C++20 370e8d8bef9SDimitry Andric template<typename K> 371e8d8bef9SDimitry Andric bool contains(const K& k) const; // C++20 3720b57cec5SDimitry Andric pair<iterator, iterator> equal_range(const key_type& k); 3730b57cec5SDimitry Andric pair<const_iterator, const_iterator> equal_range(const key_type& k) const; 374e8d8bef9SDimitry Andric template<typename K> 375e8d8bef9SDimitry Andric pair<iterator, iterator> equal_range(const K& k); // C++20 376e8d8bef9SDimitry Andric template<typename K> 377e8d8bef9SDimitry Andric pair<const_iterator, const_iterator> equal_range(const K& k) const; // C++20 3780b57cec5SDimitry Andric 3790b57cec5SDimitry Andric size_type bucket_count() const noexcept; 3800b57cec5SDimitry Andric size_type max_bucket_count() const noexcept; 3810b57cec5SDimitry Andric 3820b57cec5SDimitry Andric size_type bucket_size(size_type n) const; 3830b57cec5SDimitry Andric size_type bucket(const key_type& k) const; 3840b57cec5SDimitry Andric 3850b57cec5SDimitry Andric local_iterator begin(size_type n); 3860b57cec5SDimitry Andric local_iterator end(size_type n); 3870b57cec5SDimitry Andric const_local_iterator begin(size_type n) const; 3880b57cec5SDimitry Andric const_local_iterator end(size_type n) const; 3890b57cec5SDimitry Andric const_local_iterator cbegin(size_type n) const; 3900b57cec5SDimitry Andric const_local_iterator cend(size_type n) const; 3910b57cec5SDimitry Andric 3920b57cec5SDimitry Andric float load_factor() const noexcept; 3930b57cec5SDimitry Andric float max_load_factor() const noexcept; 3940b57cec5SDimitry Andric void max_load_factor(float z); 3950b57cec5SDimitry Andric void rehash(size_type n); 3960b57cec5SDimitry Andric void reserve(size_type n); 3970b57cec5SDimitry Andric}; 3980b57cec5SDimitry Andric 399349cc55cSDimitry Andrictemplate<class InputIterator, 400349cc55cSDimitry Andric class Hash = hash<typename iterator_traits<InputIterator>::value_type>, 401349cc55cSDimitry Andric class Pred = equal_to<typename iterator_traits<InputIterator>::value_type>, 402349cc55cSDimitry Andric class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>> 403349cc55cSDimitry Andricunordered_multiset(InputIterator, InputIterator, see below::size_type = see below, 404349cc55cSDimitry Andric Hash = Hash(), Pred = Pred(), Allocator = Allocator()) 405349cc55cSDimitry Andric -> unordered_multiset<typename iterator_traits<InputIterator>::value_type, 406349cc55cSDimitry Andric Hash, Pred, Allocator>; // C++17 407349cc55cSDimitry Andric 408349cc55cSDimitry Andrictemplate<class T, class Hash = hash<T>, 409349cc55cSDimitry Andric class Pred = equal_to<T>, class Allocator = allocator<T>> 410349cc55cSDimitry Andricunordered_multiset(initializer_list<T>, typename see below::size_type = see below, 411349cc55cSDimitry Andric Hash = Hash(), Pred = Pred(), Allocator = Allocator()) 412349cc55cSDimitry Andric -> unordered_multiset<T, Hash, Pred, Allocator>; // C++17 413349cc55cSDimitry Andric 414349cc55cSDimitry Andrictemplate<class InputIterator, class Allocator> 415349cc55cSDimitry Andricunordered_multiset(InputIterator, InputIterator, typename see below::size_type, Allocator) 416349cc55cSDimitry Andric -> unordered_multiset<typename iterator_traits<InputIterator>::value_type, 417349cc55cSDimitry Andric hash<typename iterator_traits<InputIterator>::value_type>, 418349cc55cSDimitry Andric equal_to<typename iterator_traits<InputIterator>::value_type>, 419349cc55cSDimitry Andric Allocator>; // C++17 420349cc55cSDimitry Andric 421349cc55cSDimitry Andrictemplate<class InputIterator, class Hash, class Allocator> 422349cc55cSDimitry Andricunordered_multiset(InputIterator, InputIterator, typename see below::size_type, 423349cc55cSDimitry Andric Hash, Allocator) 424349cc55cSDimitry Andric -> unordered_multiset<typename iterator_traits<InputIterator>::value_type, Hash, 425349cc55cSDimitry Andric equal_to<typename iterator_traits<InputIterator>::value_type>, Allocator>; // C++17 426349cc55cSDimitry Andric 427349cc55cSDimitry Andrictemplate<class T, class Allocator> 428349cc55cSDimitry Andricunordered_multiset(initializer_list<T>, typename see below::size_type, Allocator) 429349cc55cSDimitry Andric -> unordered_multiset<T, hash<T>, equal_to<T>, Allocator>; // C++17 430349cc55cSDimitry Andric 431349cc55cSDimitry Andrictemplate<class T, class Hash, class Allocator> 432349cc55cSDimitry Andricunordered_multiset(initializer_list<T>, typename see below::size_type, Hash, Allocator) 433349cc55cSDimitry Andric -> unordered_multiset<T, Hash, equal_to<T>, Allocator>; // C++17 434349cc55cSDimitry Andric 4350b57cec5SDimitry Andrictemplate <class Value, class Hash, class Pred, class Alloc> 4360b57cec5SDimitry Andric void swap(unordered_multiset<Value, Hash, Pred, Alloc>& x, 4370b57cec5SDimitry Andric unordered_multiset<Value, Hash, Pred, Alloc>& y) 4380b57cec5SDimitry Andric noexcept(noexcept(x.swap(y))); 4390b57cec5SDimitry Andric 4400b57cec5SDimitry Andrictemplate <class K, class T, class H, class P, class A, class Predicate> 4415ffd83dbSDimitry Andric typename unordered_set<K, T, H, P, A>::size_type 4425ffd83dbSDimitry Andric erase_if(unordered_set<K, T, H, P, A>& c, Predicate pred); // C++20 4430b57cec5SDimitry Andric 4440b57cec5SDimitry Andrictemplate <class K, class T, class H, class P, class A, class Predicate> 4455ffd83dbSDimitry Andric typename unordered_multiset<K, T, H, P, A>::size_type 4465ffd83dbSDimitry Andric erase_if(unordered_multiset<K, T, H, P, A>& c, Predicate pred); // C++20 4470b57cec5SDimitry Andric 4480b57cec5SDimitry Andric 4490b57cec5SDimitry Andrictemplate <class Value, class Hash, class Pred, class Alloc> 4500b57cec5SDimitry Andric bool 4510b57cec5SDimitry Andric operator==(const unordered_multiset<Value, Hash, Pred, Alloc>& x, 4520b57cec5SDimitry Andric const unordered_multiset<Value, Hash, Pred, Alloc>& y); 4530b57cec5SDimitry Andric 4540b57cec5SDimitry Andrictemplate <class Value, class Hash, class Pred, class Alloc> 4550b57cec5SDimitry Andric bool 4560b57cec5SDimitry Andric operator!=(const unordered_multiset<Value, Hash, Pred, Alloc>& x, 4570b57cec5SDimitry Andric const unordered_multiset<Value, Hash, Pred, Alloc>& y); 4580b57cec5SDimitry Andric} // std 4590b57cec5SDimitry Andric 4600b57cec5SDimitry Andric*/ 4610b57cec5SDimitry Andric 46281ad6265SDimitry Andric#include <__algorithm/is_permutation.h> 46381ad6265SDimitry Andric#include <__assert> // all public C++ headers provide the assertion handler 4640b57cec5SDimitry Andric#include <__config> 465fe6060f1SDimitry Andric#include <__debug> 466fe6060f1SDimitry Andric#include <__functional/is_transparent.h> 46781ad6265SDimitry Andric#include <__functional/operations.h> 4680b57cec5SDimitry Andric#include <__hash_table> 46981ad6265SDimitry Andric#include <__iterator/distance.h> 47081ad6265SDimitry Andric#include <__iterator/erase_if_container.h> 47181ad6265SDimitry Andric#include <__iterator/iterator_traits.h> 47204eeddc0SDimitry Andric#include <__memory/addressof.h> 473*bdd1243dSDimitry Andric#include <__memory/allocator.h> 474*bdd1243dSDimitry Andric#include <__memory_resource/polymorphic_allocator.h> 4750b57cec5SDimitry Andric#include <__node_handle> 476*bdd1243dSDimitry Andric#include <__type_traits/is_allocator.h> 477fe6060f1SDimitry Andric#include <__utility/forward.h> 4780b57cec5SDimitry Andric#include <version> 4790b57cec5SDimitry Andric 48081ad6265SDimitry Andric// standard-mandated includes 48181ad6265SDimitry Andric 48281ad6265SDimitry Andric// [iterator.range] 48381ad6265SDimitry Andric#include <__iterator/access.h> 48481ad6265SDimitry Andric#include <__iterator/data.h> 48581ad6265SDimitry Andric#include <__iterator/empty.h> 48681ad6265SDimitry Andric#include <__iterator/reverse_access.h> 48781ad6265SDimitry Andric#include <__iterator/size.h> 48881ad6265SDimitry Andric 48981ad6265SDimitry Andric// [unord.set.syn] 49081ad6265SDimitry Andric#include <compare> 49181ad6265SDimitry Andric#include <initializer_list> 49281ad6265SDimitry Andric 4930b57cec5SDimitry Andric#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 4940b57cec5SDimitry Andric# pragma GCC system_header 4950b57cec5SDimitry Andric#endif 4960b57cec5SDimitry Andric 4970b57cec5SDimitry Andric_LIBCPP_BEGIN_NAMESPACE_STD 4980b57cec5SDimitry Andric 4990b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 5000b57cec5SDimitry Andricclass unordered_multiset; 5010b57cec5SDimitry Andric 5020b57cec5SDimitry Andrictemplate <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>, 5030b57cec5SDimitry Andric class _Alloc = allocator<_Value> > 5040b57cec5SDimitry Andricclass _LIBCPP_TEMPLATE_VIS unordered_set 5050b57cec5SDimitry Andric{ 5060b57cec5SDimitry Andricpublic: 5070b57cec5SDimitry Andric // types 5080b57cec5SDimitry Andric typedef _Value key_type; 5090b57cec5SDimitry Andric typedef key_type value_type; 51081ad6265SDimitry Andric typedef __type_identity_t<_Hash> hasher; 51181ad6265SDimitry Andric typedef __type_identity_t<_Pred> key_equal; 51281ad6265SDimitry Andric typedef __type_identity_t<_Alloc> allocator_type; 5130b57cec5SDimitry Andric typedef value_type& reference; 5140b57cec5SDimitry Andric typedef const value_type& const_reference; 5150b57cec5SDimitry Andric static_assert((is_same<value_type, typename allocator_type::value_type>::value), 5160b57cec5SDimitry Andric "Invalid allocator::value_type"); 5170b57cec5SDimitry Andric 518*bdd1243dSDimitry Andric static_assert(is_same<allocator_type, __rebind_alloc<allocator_traits<allocator_type>, value_type> >::value, 519*bdd1243dSDimitry Andric "[allocator.requirements] states that rebinding an allocator to the same type should result in the " 520*bdd1243dSDimitry Andric "original allocator"); 521*bdd1243dSDimitry Andric 5220b57cec5SDimitry Andric private: 5230b57cec5SDimitry Andric typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table; 5240b57cec5SDimitry Andric 5250b57cec5SDimitry Andric __table __table_; 5260b57cec5SDimitry Andric 5270b57cec5SDimitry Andricpublic: 5280b57cec5SDimitry Andric typedef typename __table::pointer pointer; 5290b57cec5SDimitry Andric typedef typename __table::const_pointer const_pointer; 5300b57cec5SDimitry Andric typedef typename __table::size_type size_type; 5310b57cec5SDimitry Andric typedef typename __table::difference_type difference_type; 5320b57cec5SDimitry Andric 5330b57cec5SDimitry Andric typedef typename __table::const_iterator iterator; 5340b57cec5SDimitry Andric typedef typename __table::const_iterator const_iterator; 5350b57cec5SDimitry Andric typedef typename __table::const_local_iterator local_iterator; 5360b57cec5SDimitry Andric typedef typename __table::const_local_iterator const_local_iterator; 5370b57cec5SDimitry Andric 5380b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 14 5390b57cec5SDimitry Andric typedef __set_node_handle<typename __table::__node, allocator_type> node_type; 5400b57cec5SDimitry Andric typedef __insert_return_type<iterator, node_type> insert_return_type; 5410b57cec5SDimitry Andric#endif 5420b57cec5SDimitry Andric 5430b57cec5SDimitry Andric template <class _Value2, class _Hash2, class _Pred2, class _Alloc2> 5440b57cec5SDimitry Andric friend class _LIBCPP_TEMPLATE_VIS unordered_set; 5450b57cec5SDimitry Andric template <class _Value2, class _Hash2, class _Pred2, class _Alloc2> 5460b57cec5SDimitry Andric friend class _LIBCPP_TEMPLATE_VIS unordered_multiset; 5470b57cec5SDimitry Andric 5480b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 5490b57cec5SDimitry Andric unordered_set() 5500b57cec5SDimitry Andric _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) 5510b57cec5SDimitry Andric { 55204eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 5530b57cec5SDimitry Andric } 5540b57cec5SDimitry Andric explicit unordered_set(size_type __n, const hasher& __hf = hasher(), 5550b57cec5SDimitry Andric const key_equal& __eql = key_equal()); 5560b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 11 5570b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 5580b57cec5SDimitry Andric unordered_set(size_type __n, const allocator_type& __a) 5590b57cec5SDimitry Andric : unordered_set(__n, hasher(), key_equal(), __a) {} 5600b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 5610b57cec5SDimitry Andric unordered_set(size_type __n, const hasher& __hf, const allocator_type& __a) 5620b57cec5SDimitry Andric : unordered_set(__n, __hf, key_equal(), __a) {} 5630b57cec5SDimitry Andric#endif 5640b57cec5SDimitry Andric unordered_set(size_type __n, const hasher& __hf, const key_equal& __eql, 5650b57cec5SDimitry Andric const allocator_type& __a); 5660b57cec5SDimitry Andric template <class _InputIterator> 5670b57cec5SDimitry Andric unordered_set(_InputIterator __first, _InputIterator __last); 5680b57cec5SDimitry Andric template <class _InputIterator> 5690b57cec5SDimitry Andric unordered_set(_InputIterator __first, _InputIterator __last, 5700b57cec5SDimitry Andric size_type __n, const hasher& __hf = hasher(), 5710b57cec5SDimitry Andric const key_equal& __eql = key_equal()); 5720b57cec5SDimitry Andric template <class _InputIterator> 5730b57cec5SDimitry Andric unordered_set(_InputIterator __first, _InputIterator __last, 5740b57cec5SDimitry Andric size_type __n, const hasher& __hf, const key_equal& __eql, 5750b57cec5SDimitry Andric const allocator_type& __a); 5760b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 11 5770b57cec5SDimitry Andric template <class _InputIterator> 5780b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 5790b57cec5SDimitry Andric unordered_set(_InputIterator __first, _InputIterator __last, 5800b57cec5SDimitry Andric size_type __n, const allocator_type& __a) 5810b57cec5SDimitry Andric : unordered_set(__first, __last, __n, hasher(), key_equal(), __a) {} 5820b57cec5SDimitry Andric template <class _InputIterator> 5830b57cec5SDimitry Andric unordered_set(_InputIterator __first, _InputIterator __last, 5840b57cec5SDimitry Andric size_type __n, const hasher& __hf, const allocator_type& __a) 5850b57cec5SDimitry Andric : unordered_set(__first, __last, __n, __hf, key_equal(), __a) {} 5860b57cec5SDimitry Andric#endif 5870b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 5880b57cec5SDimitry Andric explicit unordered_set(const allocator_type& __a); 5890b57cec5SDimitry Andric unordered_set(const unordered_set& __u); 5900b57cec5SDimitry Andric unordered_set(const unordered_set& __u, const allocator_type& __a); 5910b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG 5920b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 5930b57cec5SDimitry Andric unordered_set(unordered_set&& __u) 5940b57cec5SDimitry Andric _NOEXCEPT_(is_nothrow_move_constructible<__table>::value); 5950b57cec5SDimitry Andric unordered_set(unordered_set&& __u, const allocator_type& __a); 5960b57cec5SDimitry Andric unordered_set(initializer_list<value_type> __il); 5970b57cec5SDimitry Andric unordered_set(initializer_list<value_type> __il, size_type __n, 5980b57cec5SDimitry Andric const hasher& __hf = hasher(), 5990b57cec5SDimitry Andric const key_equal& __eql = key_equal()); 6000b57cec5SDimitry Andric unordered_set(initializer_list<value_type> __il, size_type __n, 6010b57cec5SDimitry Andric const hasher& __hf, const key_equal& __eql, 6020b57cec5SDimitry Andric const allocator_type& __a); 6030b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 11 6040b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 6050b57cec5SDimitry Andric unordered_set(initializer_list<value_type> __il, size_type __n, 6060b57cec5SDimitry Andric const allocator_type& __a) 6070b57cec5SDimitry Andric : unordered_set(__il, __n, hasher(), key_equal(), __a) {} 6080b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 6090b57cec5SDimitry Andric unordered_set(initializer_list<value_type> __il, size_type __n, 6100b57cec5SDimitry Andric const hasher& __hf, const allocator_type& __a) 6110b57cec5SDimitry Andric : unordered_set(__il, __n, __hf, key_equal(), __a) {} 6120b57cec5SDimitry Andric#endif 6130b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG 6140b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6150b57cec5SDimitry Andric ~unordered_set() { 616*bdd1243dSDimitry Andric static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), ""); 6170b57cec5SDimitry Andric } 6180b57cec5SDimitry Andric 6190b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6200b57cec5SDimitry Andric unordered_set& operator=(const unordered_set& __u) 6210b57cec5SDimitry Andric { 6220b57cec5SDimitry Andric __table_ = __u.__table_; 6230b57cec5SDimitry Andric return *this; 6240b57cec5SDimitry Andric } 6250b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG 6260b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6270b57cec5SDimitry Andric unordered_set& operator=(unordered_set&& __u) 6280b57cec5SDimitry Andric _NOEXCEPT_(is_nothrow_move_assignable<__table>::value); 6290b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6300b57cec5SDimitry Andric unordered_set& operator=(initializer_list<value_type> __il); 6310b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG 6320b57cec5SDimitry Andric 6330b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6340b57cec5SDimitry Andric allocator_type get_allocator() const _NOEXCEPT 6350b57cec5SDimitry Andric {return allocator_type(__table_.__node_alloc());} 6360b57cec5SDimitry Andric 6370b57cec5SDimitry Andric _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY 6380b57cec5SDimitry Andric bool empty() const _NOEXCEPT {return __table_.size() == 0;} 6390b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6400b57cec5SDimitry Andric size_type size() const _NOEXCEPT {return __table_.size();} 6410b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6420b57cec5SDimitry Andric size_type max_size() const _NOEXCEPT {return __table_.max_size();} 6430b57cec5SDimitry Andric 6440b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6450b57cec5SDimitry Andric iterator begin() _NOEXCEPT {return __table_.begin();} 6460b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6470b57cec5SDimitry Andric iterator end() _NOEXCEPT {return __table_.end();} 6480b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6490b57cec5SDimitry Andric const_iterator begin() const _NOEXCEPT {return __table_.begin();} 6500b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6510b57cec5SDimitry Andric const_iterator end() const _NOEXCEPT {return __table_.end();} 6520b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6530b57cec5SDimitry Andric const_iterator cbegin() const _NOEXCEPT {return __table_.begin();} 6540b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6550b57cec5SDimitry Andric const_iterator cend() const _NOEXCEPT {return __table_.end();} 6560b57cec5SDimitry Andric 6570b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG 6580b57cec5SDimitry Andric template <class... _Args> 6590b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6600b57cec5SDimitry Andric pair<iterator, bool> emplace(_Args&&... __args) 6610b57cec5SDimitry Andric {return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...);} 6620b57cec5SDimitry Andric template <class... _Args> 6630b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 66481ad6265SDimitry Andric iterator emplace_hint(const_iterator __p, _Args&&... __args) { 66581ad6265SDimitry Andric _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__p)) == this, 6660b57cec5SDimitry Andric "unordered_set::emplace_hint(const_iterator, args...) called with an iterator not" 6670b57cec5SDimitry Andric " referring to this unordered_set"); 66881ad6265SDimitry Andric (void)__p; 66981ad6265SDimitry Andric return __table_.__emplace_unique(std::forward<_Args>(__args)...).first; 6700b57cec5SDimitry Andric } 6710b57cec5SDimitry Andric 6720b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6730b57cec5SDimitry Andric pair<iterator, bool> insert(value_type&& __x) 6740b57cec5SDimitry Andric {return __table_.__insert_unique(_VSTD::move(__x));} 6750b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 67681ad6265SDimitry Andric iterator insert(const_iterator __p, value_type&& __x) { 67781ad6265SDimitry Andric _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__p)) == this, 6780b57cec5SDimitry Andric "unordered_set::insert(const_iterator, value_type&&) called with an iterator not" 6790b57cec5SDimitry Andric " referring to this unordered_set"); 68081ad6265SDimitry Andric (void)__p; 68181ad6265SDimitry Andric return insert(std::move(__x)).first; 6820b57cec5SDimitry Andric } 68381ad6265SDimitry Andric 6840b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6850b57cec5SDimitry Andric void insert(initializer_list<value_type> __il) 6860b57cec5SDimitry Andric {insert(__il.begin(), __il.end());} 6870b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG 6880b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6890b57cec5SDimitry Andric pair<iterator, bool> insert(const value_type& __x) 6900b57cec5SDimitry Andric {return __table_.__insert_unique(__x);} 6910b57cec5SDimitry Andric 6920b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 69381ad6265SDimitry Andric iterator insert(const_iterator __p, const value_type& __x) { 69481ad6265SDimitry Andric _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__p)) == this, 6950b57cec5SDimitry Andric "unordered_set::insert(const_iterator, const value_type&) called with an iterator not" 6960b57cec5SDimitry Andric " referring to this unordered_set"); 69781ad6265SDimitry Andric (void)__p; 6980b57cec5SDimitry Andric return insert(__x).first; 6990b57cec5SDimitry Andric } 7000b57cec5SDimitry Andric template <class _InputIterator> 7010b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7020b57cec5SDimitry Andric void insert(_InputIterator __first, _InputIterator __last); 7030b57cec5SDimitry Andric 7040b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7050b57cec5SDimitry Andric iterator erase(const_iterator __p) {return __table_.erase(__p);} 7060b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7070b57cec5SDimitry Andric size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);} 7080b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7090b57cec5SDimitry Andric iterator erase(const_iterator __first, const_iterator __last) 7100b57cec5SDimitry Andric {return __table_.erase(__first, __last);} 7110b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7120b57cec5SDimitry Andric void clear() _NOEXCEPT {__table_.clear();} 7130b57cec5SDimitry Andric 7140b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 14 7150b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7160b57cec5SDimitry Andric insert_return_type insert(node_type&& __nh) 7170b57cec5SDimitry Andric { 7180b57cec5SDimitry Andric _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), 7190b57cec5SDimitry Andric "node_type with incompatible allocator passed to unordered_set::insert()"); 7200b57cec5SDimitry Andric return __table_.template __node_handle_insert_unique< 7210b57cec5SDimitry Andric node_type, insert_return_type>(_VSTD::move(__nh)); 7220b57cec5SDimitry Andric } 7230b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7240b57cec5SDimitry Andric iterator insert(const_iterator __h, node_type&& __nh) 7250b57cec5SDimitry Andric { 7260b57cec5SDimitry Andric _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), 7270b57cec5SDimitry Andric "node_type with incompatible allocator passed to unordered_set::insert()"); 7280b57cec5SDimitry Andric return __table_.template __node_handle_insert_unique<node_type>( 7290b57cec5SDimitry Andric __h, _VSTD::move(__nh)); 7300b57cec5SDimitry Andric } 7310b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7320b57cec5SDimitry Andric node_type extract(key_type const& __key) 7330b57cec5SDimitry Andric { 7340b57cec5SDimitry Andric return __table_.template __node_handle_extract<node_type>(__key); 7350b57cec5SDimitry Andric } 7360b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7370b57cec5SDimitry Andric node_type extract(const_iterator __it) 7380b57cec5SDimitry Andric { 7390b57cec5SDimitry Andric return __table_.template __node_handle_extract<node_type>(__it); 7400b57cec5SDimitry Andric } 7410b57cec5SDimitry Andric 7420b57cec5SDimitry Andric template<class _H2, class _P2> 7430b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7440b57cec5SDimitry Andric void merge(unordered_set<key_type, _H2, _P2, allocator_type>& __source) 7450b57cec5SDimitry Andric { 7460b57cec5SDimitry Andric _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 7470b57cec5SDimitry Andric "merging container with incompatible allocator"); 7480b57cec5SDimitry Andric __table_.__node_handle_merge_unique(__source.__table_); 7490b57cec5SDimitry Andric } 7500b57cec5SDimitry Andric template<class _H2, class _P2> 7510b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7520b57cec5SDimitry Andric void merge(unordered_set<key_type, _H2, _P2, allocator_type>&& __source) 7530b57cec5SDimitry Andric { 7540b57cec5SDimitry Andric _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 7550b57cec5SDimitry Andric "merging container with incompatible allocator"); 7560b57cec5SDimitry Andric __table_.__node_handle_merge_unique(__source.__table_); 7570b57cec5SDimitry Andric } 7580b57cec5SDimitry Andric template<class _H2, class _P2> 7590b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7600b57cec5SDimitry Andric void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>& __source) 7610b57cec5SDimitry Andric { 7620b57cec5SDimitry Andric _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 7630b57cec5SDimitry Andric "merging container with incompatible allocator"); 7640b57cec5SDimitry Andric __table_.__node_handle_merge_unique(__source.__table_); 7650b57cec5SDimitry Andric } 7660b57cec5SDimitry Andric template<class _H2, class _P2> 7670b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7680b57cec5SDimitry Andric void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>&& __source) 7690b57cec5SDimitry Andric { 7700b57cec5SDimitry Andric _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 7710b57cec5SDimitry Andric "merging container with incompatible allocator"); 7720b57cec5SDimitry Andric __table_.__node_handle_merge_unique(__source.__table_); 7730b57cec5SDimitry Andric } 7740b57cec5SDimitry Andric#endif 7750b57cec5SDimitry Andric 7760b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7770b57cec5SDimitry Andric void swap(unordered_set& __u) 7780b57cec5SDimitry Andric _NOEXCEPT_(__is_nothrow_swappable<__table>::value) 7790b57cec5SDimitry Andric {__table_.swap(__u.__table_);} 7800b57cec5SDimitry Andric 7810b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7820b57cec5SDimitry Andric hasher hash_function() const {return __table_.hash_function();} 7830b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7840b57cec5SDimitry Andric key_equal key_eq() const {return __table_.key_eq();} 7850b57cec5SDimitry Andric 7860b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7870b57cec5SDimitry Andric iterator find(const key_type& __k) {return __table_.find(__k);} 7880b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7890b57cec5SDimitry Andric const_iterator find(const key_type& __k) const {return __table_.find(__k);} 790e8d8bef9SDimitry Andric#if _LIBCPP_STD_VER > 17 791349cc55cSDimitry Andric template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 792e8d8bef9SDimitry Andric _LIBCPP_INLINE_VISIBILITY 793349cc55cSDimitry Andric iterator find(const _K2& __k) {return __table_.find(__k);} 794349cc55cSDimitry Andric template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 795e8d8bef9SDimitry Andric _LIBCPP_INLINE_VISIBILITY 796349cc55cSDimitry Andric const_iterator find(const _K2& __k) const {return __table_.find(__k);} 797e8d8bef9SDimitry Andric#endif // _LIBCPP_STD_VER > 17 798349cc55cSDimitry Andric 7990b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8000b57cec5SDimitry Andric size_type count(const key_type& __k) const {return __table_.__count_unique(__k);} 8010b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 17 802349cc55cSDimitry Andric template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 803e8d8bef9SDimitry Andric _LIBCPP_INLINE_VISIBILITY 804349cc55cSDimitry Andric size_type count(const _K2& __k) const {return __table_.__count_unique(__k);} 805e8d8bef9SDimitry Andric#endif // _LIBCPP_STD_VER > 17 806349cc55cSDimitry Andric 807e8d8bef9SDimitry Andric#if _LIBCPP_STD_VER > 17 8080b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8090b57cec5SDimitry Andric bool contains(const key_type& __k) const {return find(__k) != end();} 810e8d8bef9SDimitry Andric 811349cc55cSDimitry Andric template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 812e8d8bef9SDimitry Andric _LIBCPP_INLINE_VISIBILITY 813349cc55cSDimitry Andric bool contains(const _K2& __k) const {return find(__k) != end();} 8140b57cec5SDimitry Andric#endif // _LIBCPP_STD_VER > 17 815349cc55cSDimitry Andric 8160b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8170b57cec5SDimitry Andric pair<iterator, iterator> equal_range(const key_type& __k) 8180b57cec5SDimitry Andric {return __table_.__equal_range_unique(__k);} 8190b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8200b57cec5SDimitry Andric pair<const_iterator, const_iterator> equal_range(const key_type& __k) const 8210b57cec5SDimitry Andric {return __table_.__equal_range_unique(__k);} 822e8d8bef9SDimitry Andric#if _LIBCPP_STD_VER > 17 823349cc55cSDimitry Andric template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 824e8d8bef9SDimitry Andric _LIBCPP_INLINE_VISIBILITY 825349cc55cSDimitry Andric pair<iterator, iterator> equal_range(const _K2& __k) 826349cc55cSDimitry Andric {return __table_.__equal_range_unique(__k);} 827349cc55cSDimitry Andric template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 828e8d8bef9SDimitry Andric _LIBCPP_INLINE_VISIBILITY 829349cc55cSDimitry Andric pair<const_iterator, const_iterator> equal_range(const _K2& __k) const 830349cc55cSDimitry Andric {return __table_.__equal_range_unique(__k);} 831e8d8bef9SDimitry Andric#endif // _LIBCPP_STD_VER > 17 8320b57cec5SDimitry Andric 8330b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8340b57cec5SDimitry Andric size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();} 8350b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8360b57cec5SDimitry Andric size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();} 8370b57cec5SDimitry Andric 8380b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8390b57cec5SDimitry Andric size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);} 8400b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8410b57cec5SDimitry Andric size_type bucket(const key_type& __k) const {return __table_.bucket(__k);} 8420b57cec5SDimitry Andric 8430b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8440b57cec5SDimitry Andric local_iterator begin(size_type __n) {return __table_.begin(__n);} 8450b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8460b57cec5SDimitry Andric local_iterator end(size_type __n) {return __table_.end(__n);} 8470b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8480b57cec5SDimitry Andric const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);} 8490b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8500b57cec5SDimitry Andric const_local_iterator end(size_type __n) const {return __table_.cend(__n);} 8510b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8520b57cec5SDimitry Andric const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);} 8530b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8540b57cec5SDimitry Andric const_local_iterator cend(size_type __n) const {return __table_.cend(__n);} 8550b57cec5SDimitry Andric 8560b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8570b57cec5SDimitry Andric float load_factor() const _NOEXCEPT {return __table_.load_factor();} 8580b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8590b57cec5SDimitry Andric float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();} 8600b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8610b57cec5SDimitry Andric void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);} 8620b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 863753f127fSDimitry Andric void rehash(size_type __n) {__table_.__rehash_unique(__n);} 8640b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 865753f127fSDimitry Andric void reserve(size_type __n) {__table_.__reserve_unique(__n);} 8660b57cec5SDimitry Andric 86781ad6265SDimitry Andric#ifdef _LIBCPP_ENABLE_DEBUG_MODE 8680b57cec5SDimitry Andric 8690b57cec5SDimitry Andric bool __dereferenceable(const const_iterator* __i) const 8700b57cec5SDimitry Andric {return __table_.__dereferenceable(__i);} 8710b57cec5SDimitry Andric bool __decrementable(const const_iterator* __i) const 8720b57cec5SDimitry Andric {return __table_.__decrementable(__i);} 8730b57cec5SDimitry Andric bool __addable(const const_iterator* __i, ptrdiff_t __n) const 8740b57cec5SDimitry Andric {return __table_.__addable(__i, __n);} 8750b57cec5SDimitry Andric bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const 8760b57cec5SDimitry Andric {return __table_.__addable(__i, __n);} 8770b57cec5SDimitry Andric 87881ad6265SDimitry Andric#endif // _LIBCPP_ENABLE_DEBUG_MODE 8790b57cec5SDimitry Andric 8800b57cec5SDimitry Andric}; 8810b57cec5SDimitry Andric 882349cc55cSDimitry Andric#if _LIBCPP_STD_VER >= 17 8830b57cec5SDimitry Andrictemplate<class _InputIterator, 8840b57cec5SDimitry Andric class _Hash = hash<__iter_value_type<_InputIterator>>, 8850b57cec5SDimitry Andric class _Pred = equal_to<__iter_value_type<_InputIterator>>, 8860b57cec5SDimitry Andric class _Allocator = allocator<__iter_value_type<_InputIterator>>, 887349cc55cSDimitry Andric class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, 888349cc55cSDimitry Andric class = enable_if_t<!__is_allocator<_Hash>::value>, 889349cc55cSDimitry Andric class = enable_if_t<!is_integral<_Hash>::value>, 890349cc55cSDimitry Andric class = enable_if_t<!__is_allocator<_Pred>::value>, 891349cc55cSDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value>> 8920b57cec5SDimitry Andricunordered_set(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0, 8930b57cec5SDimitry Andric _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) 8940b57cec5SDimitry Andric -> unordered_set<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>; 8950b57cec5SDimitry Andric 8960b57cec5SDimitry Andrictemplate<class _Tp, class _Hash = hash<_Tp>, 8970b57cec5SDimitry Andric class _Pred = equal_to<_Tp>, 8980b57cec5SDimitry Andric class _Allocator = allocator<_Tp>, 899349cc55cSDimitry Andric class = enable_if_t<!__is_allocator<_Hash>::value>, 900349cc55cSDimitry Andric class = enable_if_t<!is_integral<_Hash>::value>, 901349cc55cSDimitry Andric class = enable_if_t<!__is_allocator<_Pred>::value>, 902349cc55cSDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value>> 9030b57cec5SDimitry Andricunordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type = 0, 9040b57cec5SDimitry Andric _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) 9050b57cec5SDimitry Andric -> unordered_set<_Tp, _Hash, _Pred, _Allocator>; 9060b57cec5SDimitry Andric 9070b57cec5SDimitry Andrictemplate<class _InputIterator, class _Allocator, 908349cc55cSDimitry Andric class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, 909349cc55cSDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value>> 9100b57cec5SDimitry Andricunordered_set(_InputIterator, _InputIterator, 9110b57cec5SDimitry Andric typename allocator_traits<_Allocator>::size_type, _Allocator) 9120b57cec5SDimitry Andric -> unordered_set<__iter_value_type<_InputIterator>, 9130b57cec5SDimitry Andric hash<__iter_value_type<_InputIterator>>, 9140b57cec5SDimitry Andric equal_to<__iter_value_type<_InputIterator>>, 9150b57cec5SDimitry Andric _Allocator>; 9160b57cec5SDimitry Andric 9170b57cec5SDimitry Andrictemplate<class _InputIterator, class _Hash, class _Allocator, 918349cc55cSDimitry Andric class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, 919349cc55cSDimitry Andric class = enable_if_t<!__is_allocator<_Hash>::value>, 920349cc55cSDimitry Andric class = enable_if_t<!is_integral<_Hash>::value>, 921349cc55cSDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value>> 9220b57cec5SDimitry Andricunordered_set(_InputIterator, _InputIterator, 9230b57cec5SDimitry Andric typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator) 9240b57cec5SDimitry Andric -> unordered_set<__iter_value_type<_InputIterator>, _Hash, 9250b57cec5SDimitry Andric equal_to<__iter_value_type<_InputIterator>>, 9260b57cec5SDimitry Andric _Allocator>; 9270b57cec5SDimitry Andric 9280b57cec5SDimitry Andrictemplate<class _Tp, class _Allocator, 929349cc55cSDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value>> 9300b57cec5SDimitry Andricunordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Allocator) 9310b57cec5SDimitry Andric -> unordered_set<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>; 9320b57cec5SDimitry Andric 9330b57cec5SDimitry Andrictemplate<class _Tp, class _Hash, class _Allocator, 934349cc55cSDimitry Andric class = enable_if_t<!__is_allocator<_Hash>::value>, 935349cc55cSDimitry Andric class = enable_if_t<!is_integral<_Hash>::value>, 936349cc55cSDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value>> 9370b57cec5SDimitry Andricunordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator) 9380b57cec5SDimitry Andric -> unordered_set<_Tp, _Hash, equal_to<_Tp>, _Allocator>; 9390b57cec5SDimitry Andric#endif 9400b57cec5SDimitry Andric 9410b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 9420b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n, 9430b57cec5SDimitry Andric const hasher& __hf, const key_equal& __eql) 9440b57cec5SDimitry Andric : __table_(__hf, __eql) 9450b57cec5SDimitry Andric{ 94604eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 947753f127fSDimitry Andric __table_.__rehash_unique(__n); 9480b57cec5SDimitry Andric} 9490b57cec5SDimitry Andric 9500b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 9510b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n, 9520b57cec5SDimitry Andric const hasher& __hf, const key_equal& __eql, const allocator_type& __a) 9530b57cec5SDimitry Andric : __table_(__hf, __eql, __a) 9540b57cec5SDimitry Andric{ 95504eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 956753f127fSDimitry Andric __table_.__rehash_unique(__n); 9570b57cec5SDimitry Andric} 9580b57cec5SDimitry Andric 9590b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 9600b57cec5SDimitry Andrictemplate <class _InputIterator> 9610b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 9620b57cec5SDimitry Andric _InputIterator __first, _InputIterator __last) 9630b57cec5SDimitry Andric{ 96404eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 9650b57cec5SDimitry Andric insert(__first, __last); 9660b57cec5SDimitry Andric} 9670b57cec5SDimitry Andric 9680b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 9690b57cec5SDimitry Andrictemplate <class _InputIterator> 9700b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 9710b57cec5SDimitry Andric _InputIterator __first, _InputIterator __last, size_type __n, 9720b57cec5SDimitry Andric const hasher& __hf, const key_equal& __eql) 9730b57cec5SDimitry Andric : __table_(__hf, __eql) 9740b57cec5SDimitry Andric{ 97504eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 976753f127fSDimitry Andric __table_.__rehash_unique(__n); 9770b57cec5SDimitry Andric insert(__first, __last); 9780b57cec5SDimitry Andric} 9790b57cec5SDimitry Andric 9800b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 9810b57cec5SDimitry Andrictemplate <class _InputIterator> 9820b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 9830b57cec5SDimitry Andric _InputIterator __first, _InputIterator __last, size_type __n, 9840b57cec5SDimitry Andric const hasher& __hf, const key_equal& __eql, const allocator_type& __a) 9850b57cec5SDimitry Andric : __table_(__hf, __eql, __a) 9860b57cec5SDimitry Andric{ 98704eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 988753f127fSDimitry Andric __table_.__rehash_unique(__n); 9890b57cec5SDimitry Andric insert(__first, __last); 9900b57cec5SDimitry Andric} 9910b57cec5SDimitry Andric 9920b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 9930b57cec5SDimitry Andricinline 9940b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 9950b57cec5SDimitry Andric const allocator_type& __a) 9960b57cec5SDimitry Andric : __table_(__a) 9970b57cec5SDimitry Andric{ 99804eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 9990b57cec5SDimitry Andric} 10000b57cec5SDimitry Andric 10010b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 10020b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 10030b57cec5SDimitry Andric const unordered_set& __u) 10040b57cec5SDimitry Andric : __table_(__u.__table_) 10050b57cec5SDimitry Andric{ 100604eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 1007753f127fSDimitry Andric __table_.__rehash_unique(__u.bucket_count()); 10080b57cec5SDimitry Andric insert(__u.begin(), __u.end()); 10090b57cec5SDimitry Andric} 10100b57cec5SDimitry Andric 10110b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 10120b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 10130b57cec5SDimitry Andric const unordered_set& __u, const allocator_type& __a) 10140b57cec5SDimitry Andric : __table_(__u.__table_, __a) 10150b57cec5SDimitry Andric{ 101604eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 1017753f127fSDimitry Andric __table_.__rehash_unique(__u.bucket_count()); 10180b57cec5SDimitry Andric insert(__u.begin(), __u.end()); 10190b57cec5SDimitry Andric} 10200b57cec5SDimitry Andric 10210b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG 10220b57cec5SDimitry Andric 10230b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 10240b57cec5SDimitry Andricinline 10250b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 10260b57cec5SDimitry Andric unordered_set&& __u) 10270b57cec5SDimitry Andric _NOEXCEPT_(is_nothrow_move_constructible<__table>::value) 10280b57cec5SDimitry Andric : __table_(_VSTD::move(__u.__table_)) 10290b57cec5SDimitry Andric{ 103004eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 103181ad6265SDimitry Andric std::__debug_db_swap(this, std::addressof(__u)); 10320b57cec5SDimitry Andric} 10330b57cec5SDimitry Andric 10340b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 10350b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 10360b57cec5SDimitry Andric unordered_set&& __u, const allocator_type& __a) 10370b57cec5SDimitry Andric : __table_(_VSTD::move(__u.__table_), __a) 10380b57cec5SDimitry Andric{ 103904eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 10400b57cec5SDimitry Andric if (__a != __u.get_allocator()) 10410b57cec5SDimitry Andric { 10420b57cec5SDimitry Andric iterator __i = __u.begin(); 10430b57cec5SDimitry Andric while (__u.size() != 0) 10440b57cec5SDimitry Andric __table_.__insert_unique(_VSTD::move(__u.__table_.remove(__i++)->__value_)); 10450b57cec5SDimitry Andric } 10460b57cec5SDimitry Andric else 104781ad6265SDimitry Andric std::__debug_db_swap(this, std::addressof(__u)); 10480b57cec5SDimitry Andric} 10490b57cec5SDimitry Andric 10500b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 10510b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 10520b57cec5SDimitry Andric initializer_list<value_type> __il) 10530b57cec5SDimitry Andric{ 105404eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 10550b57cec5SDimitry Andric insert(__il.begin(), __il.end()); 10560b57cec5SDimitry Andric} 10570b57cec5SDimitry Andric 10580b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 10590b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 10600b57cec5SDimitry Andric initializer_list<value_type> __il, size_type __n, const hasher& __hf, 10610b57cec5SDimitry Andric const key_equal& __eql) 10620b57cec5SDimitry Andric : __table_(__hf, __eql) 10630b57cec5SDimitry Andric{ 106404eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 1065753f127fSDimitry Andric __table_.__rehash_unique(__n); 10660b57cec5SDimitry Andric insert(__il.begin(), __il.end()); 10670b57cec5SDimitry Andric} 10680b57cec5SDimitry Andric 10690b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 10700b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 10710b57cec5SDimitry Andric initializer_list<value_type> __il, size_type __n, const hasher& __hf, 10720b57cec5SDimitry Andric const key_equal& __eql, const allocator_type& __a) 10730b57cec5SDimitry Andric : __table_(__hf, __eql, __a) 10740b57cec5SDimitry Andric{ 107504eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 1076753f127fSDimitry Andric __table_.__rehash_unique(__n); 10770b57cec5SDimitry Andric insert(__il.begin(), __il.end()); 10780b57cec5SDimitry Andric} 10790b57cec5SDimitry Andric 10800b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 10810b57cec5SDimitry Andricinline 10820b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>& 10830b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(unordered_set&& __u) 10840b57cec5SDimitry Andric _NOEXCEPT_(is_nothrow_move_assignable<__table>::value) 10850b57cec5SDimitry Andric{ 10860b57cec5SDimitry Andric __table_ = _VSTD::move(__u.__table_); 10870b57cec5SDimitry Andric return *this; 10880b57cec5SDimitry Andric} 10890b57cec5SDimitry Andric 10900b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 10910b57cec5SDimitry Andricinline 10920b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>& 10930b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::operator=( 10940b57cec5SDimitry Andric initializer_list<value_type> __il) 10950b57cec5SDimitry Andric{ 10960b57cec5SDimitry Andric __table_.__assign_unique(__il.begin(), __il.end()); 10970b57cec5SDimitry Andric return *this; 10980b57cec5SDimitry Andric} 10990b57cec5SDimitry Andric 11000b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG 11010b57cec5SDimitry Andric 11020b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 11030b57cec5SDimitry Andrictemplate <class _InputIterator> 11040b57cec5SDimitry Andricinline 11050b57cec5SDimitry Andricvoid 11060b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, 11070b57cec5SDimitry Andric _InputIterator __last) 11080b57cec5SDimitry Andric{ 11090b57cec5SDimitry Andric for (; __first != __last; ++__first) 11100b57cec5SDimitry Andric __table_.__insert_unique(*__first); 11110b57cec5SDimitry Andric} 11120b57cec5SDimitry Andric 11130b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 11140b57cec5SDimitry Andricinline _LIBCPP_INLINE_VISIBILITY 11150b57cec5SDimitry Andricvoid 11160b57cec5SDimitry Andricswap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, 11170b57cec5SDimitry Andric unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) 11180b57cec5SDimitry Andric _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) 11190b57cec5SDimitry Andric{ 11200b57cec5SDimitry Andric __x.swap(__y); 11210b57cec5SDimitry Andric} 11220b57cec5SDimitry Andric 11230b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 17 11245ffd83dbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc, 11255ffd83dbSDimitry Andric class _Predicate> 11260b57cec5SDimitry Andricinline _LIBCPP_INLINE_VISIBILITY 11275ffd83dbSDimitry Andric typename unordered_set<_Value, _Hash, _Pred, _Alloc>::size_type 11285ffd83dbSDimitry Andric erase_if(unordered_set<_Value, _Hash, _Pred, _Alloc>& __c, 11295ffd83dbSDimitry Andric _Predicate __pred) { 1130fe6060f1SDimitry Andric return _VSTD::__libcpp_erase_if_container(__c, __pred); 11315ffd83dbSDimitry Andric} 11320b57cec5SDimitry Andric#endif 11330b57cec5SDimitry Andric 11340b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 1135*bdd1243dSDimitry Andric_LIBCPP_HIDE_FROM_ABI bool 11360b57cec5SDimitry Andricoperator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, 11370b57cec5SDimitry Andric const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) 11380b57cec5SDimitry Andric{ 11390b57cec5SDimitry Andric if (__x.size() != __y.size()) 11400b57cec5SDimitry Andric return false; 11410b57cec5SDimitry Andric typedef typename unordered_set<_Value, _Hash, _Pred, _Alloc>::const_iterator 11420b57cec5SDimitry Andric const_iterator; 11430b57cec5SDimitry Andric for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end(); 11440b57cec5SDimitry Andric __i != __ex; ++__i) 11450b57cec5SDimitry Andric { 11460b57cec5SDimitry Andric const_iterator __j = __y.find(*__i); 11470b57cec5SDimitry Andric if (__j == __ey || !(*__i == *__j)) 11480b57cec5SDimitry Andric return false; 11490b57cec5SDimitry Andric } 11500b57cec5SDimitry Andric return true; 11510b57cec5SDimitry Andric} 11520b57cec5SDimitry Andric 11530b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 11540b57cec5SDimitry Andricinline _LIBCPP_INLINE_VISIBILITY 11550b57cec5SDimitry Andricbool 11560b57cec5SDimitry Andricoperator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, 11570b57cec5SDimitry Andric const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) 11580b57cec5SDimitry Andric{ 11590b57cec5SDimitry Andric return !(__x == __y); 11600b57cec5SDimitry Andric} 11610b57cec5SDimitry Andric 11620b57cec5SDimitry Andrictemplate <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>, 11630b57cec5SDimitry Andric class _Alloc = allocator<_Value> > 11640b57cec5SDimitry Andricclass _LIBCPP_TEMPLATE_VIS unordered_multiset 11650b57cec5SDimitry Andric{ 11660b57cec5SDimitry Andricpublic: 11670b57cec5SDimitry Andric // types 11680b57cec5SDimitry Andric typedef _Value key_type; 11690b57cec5SDimitry Andric typedef key_type value_type; 117081ad6265SDimitry Andric typedef __type_identity_t<_Hash> hasher; 117181ad6265SDimitry Andric typedef __type_identity_t<_Pred> key_equal; 117281ad6265SDimitry Andric typedef __type_identity_t<_Alloc> allocator_type; 11730b57cec5SDimitry Andric typedef value_type& reference; 11740b57cec5SDimitry Andric typedef const value_type& const_reference; 11750b57cec5SDimitry Andric static_assert((is_same<value_type, typename allocator_type::value_type>::value), 11760b57cec5SDimitry Andric "Invalid allocator::value_type"); 11770b57cec5SDimitry Andric 11780b57cec5SDimitry Andricprivate: 11790b57cec5SDimitry Andric typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table; 11800b57cec5SDimitry Andric 11810b57cec5SDimitry Andric __table __table_; 11820b57cec5SDimitry Andric 11830b57cec5SDimitry Andricpublic: 11840b57cec5SDimitry Andric typedef typename __table::pointer pointer; 11850b57cec5SDimitry Andric typedef typename __table::const_pointer const_pointer; 11860b57cec5SDimitry Andric typedef typename __table::size_type size_type; 11870b57cec5SDimitry Andric typedef typename __table::difference_type difference_type; 11880b57cec5SDimitry Andric 11890b57cec5SDimitry Andric typedef typename __table::const_iterator iterator; 11900b57cec5SDimitry Andric typedef typename __table::const_iterator const_iterator; 11910b57cec5SDimitry Andric typedef typename __table::const_local_iterator local_iterator; 11920b57cec5SDimitry Andric typedef typename __table::const_local_iterator const_local_iterator; 11930b57cec5SDimitry Andric 11940b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 14 11950b57cec5SDimitry Andric typedef __set_node_handle<typename __table::__node, allocator_type> node_type; 11960b57cec5SDimitry Andric#endif 11970b57cec5SDimitry Andric 11980b57cec5SDimitry Andric template <class _Value2, class _Hash2, class _Pred2, class _Alloc2> 11990b57cec5SDimitry Andric friend class _LIBCPP_TEMPLATE_VIS unordered_set; 12000b57cec5SDimitry Andric template <class _Value2, class _Hash2, class _Pred2, class _Alloc2> 12010b57cec5SDimitry Andric friend class _LIBCPP_TEMPLATE_VIS unordered_multiset; 12020b57cec5SDimitry Andric 12030b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 12040b57cec5SDimitry Andric unordered_multiset() 12050b57cec5SDimitry Andric _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) 12060b57cec5SDimitry Andric { 120704eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 12080b57cec5SDimitry Andric } 12090b57cec5SDimitry Andric explicit unordered_multiset(size_type __n, const hasher& __hf = hasher(), 12100b57cec5SDimitry Andric const key_equal& __eql = key_equal()); 12110b57cec5SDimitry Andric unordered_multiset(size_type __n, const hasher& __hf, 12120b57cec5SDimitry Andric const key_equal& __eql, const allocator_type& __a); 12130b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 11 12140b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 12150b57cec5SDimitry Andric unordered_multiset(size_type __n, const allocator_type& __a) 12160b57cec5SDimitry Andric : unordered_multiset(__n, hasher(), key_equal(), __a) {} 12170b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 12180b57cec5SDimitry Andric unordered_multiset(size_type __n, const hasher& __hf, const allocator_type& __a) 12190b57cec5SDimitry Andric : unordered_multiset(__n, __hf, key_equal(), __a) {} 12200b57cec5SDimitry Andric#endif 12210b57cec5SDimitry Andric template <class _InputIterator> 12220b57cec5SDimitry Andric unordered_multiset(_InputIterator __first, _InputIterator __last); 12230b57cec5SDimitry Andric template <class _InputIterator> 12240b57cec5SDimitry Andric unordered_multiset(_InputIterator __first, _InputIterator __last, 12250b57cec5SDimitry Andric size_type __n, const hasher& __hf = hasher(), 12260b57cec5SDimitry Andric const key_equal& __eql = key_equal()); 12270b57cec5SDimitry Andric template <class _InputIterator> 12280b57cec5SDimitry Andric unordered_multiset(_InputIterator __first, _InputIterator __last, 12290b57cec5SDimitry Andric size_type __n , const hasher& __hf, 12300b57cec5SDimitry Andric const key_equal& __eql, const allocator_type& __a); 12310b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 11 12320b57cec5SDimitry Andric template <class _InputIterator> 12330b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 12340b57cec5SDimitry Andric unordered_multiset(_InputIterator __first, _InputIterator __last, 12350b57cec5SDimitry Andric size_type __n, const allocator_type& __a) 12360b57cec5SDimitry Andric : unordered_multiset(__first, __last, __n, hasher(), key_equal(), __a) {} 12370b57cec5SDimitry Andric template <class _InputIterator> 12380b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 12390b57cec5SDimitry Andric unordered_multiset(_InputIterator __first, _InputIterator __last, 12400b57cec5SDimitry Andric size_type __n, const hasher& __hf, const allocator_type& __a) 12410b57cec5SDimitry Andric : unordered_multiset(__first, __last, __n, __hf, key_equal(), __a) {} 12420b57cec5SDimitry Andric#endif 12430b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 12440b57cec5SDimitry Andric explicit unordered_multiset(const allocator_type& __a); 12450b57cec5SDimitry Andric unordered_multiset(const unordered_multiset& __u); 12460b57cec5SDimitry Andric unordered_multiset(const unordered_multiset& __u, const allocator_type& __a); 12470b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG 12480b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 12490b57cec5SDimitry Andric unordered_multiset(unordered_multiset&& __u) 12500b57cec5SDimitry Andric _NOEXCEPT_(is_nothrow_move_constructible<__table>::value); 12510b57cec5SDimitry Andric unordered_multiset(unordered_multiset&& __u, const allocator_type& __a); 12520b57cec5SDimitry Andric unordered_multiset(initializer_list<value_type> __il); 12530b57cec5SDimitry Andric unordered_multiset(initializer_list<value_type> __il, size_type __n, 12540b57cec5SDimitry Andric const hasher& __hf = hasher(), 12550b57cec5SDimitry Andric const key_equal& __eql = key_equal()); 12560b57cec5SDimitry Andric unordered_multiset(initializer_list<value_type> __il, size_type __n, 12570b57cec5SDimitry Andric const hasher& __hf, const key_equal& __eql, 12580b57cec5SDimitry Andric const allocator_type& __a); 12590b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 11 12600b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 12610b57cec5SDimitry Andric unordered_multiset(initializer_list<value_type> __il, size_type __n, const allocator_type& __a) 12620b57cec5SDimitry Andric : unordered_multiset(__il, __n, hasher(), key_equal(), __a) {} 12630b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 12640b57cec5SDimitry Andric unordered_multiset(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a) 12650b57cec5SDimitry Andric : unordered_multiset(__il, __n, __hf, key_equal(), __a) {} 12660b57cec5SDimitry Andric#endif 12670b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG 12680b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 12690b57cec5SDimitry Andric ~unordered_multiset() { 1270*bdd1243dSDimitry Andric static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), ""); 12710b57cec5SDimitry Andric } 12720b57cec5SDimitry Andric 12730b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 12740b57cec5SDimitry Andric unordered_multiset& operator=(const unordered_multiset& __u) 12750b57cec5SDimitry Andric { 12760b57cec5SDimitry Andric __table_ = __u.__table_; 12770b57cec5SDimitry Andric return *this; 12780b57cec5SDimitry Andric } 12790b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG 12800b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 12810b57cec5SDimitry Andric unordered_multiset& operator=(unordered_multiset&& __u) 12820b57cec5SDimitry Andric _NOEXCEPT_(is_nothrow_move_assignable<__table>::value); 12830b57cec5SDimitry Andric unordered_multiset& operator=(initializer_list<value_type> __il); 12840b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG 12850b57cec5SDimitry Andric 12860b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 12870b57cec5SDimitry Andric allocator_type get_allocator() const _NOEXCEPT 12880b57cec5SDimitry Andric {return allocator_type(__table_.__node_alloc());} 12890b57cec5SDimitry Andric 12900b57cec5SDimitry Andric _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY 12910b57cec5SDimitry Andric bool empty() const _NOEXCEPT {return __table_.size() == 0;} 12920b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 12930b57cec5SDimitry Andric size_type size() const _NOEXCEPT {return __table_.size();} 12940b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 12950b57cec5SDimitry Andric size_type max_size() const _NOEXCEPT {return __table_.max_size();} 12960b57cec5SDimitry Andric 12970b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 12980b57cec5SDimitry Andric iterator begin() _NOEXCEPT {return __table_.begin();} 12990b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13000b57cec5SDimitry Andric iterator end() _NOEXCEPT {return __table_.end();} 13010b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13020b57cec5SDimitry Andric const_iterator begin() const _NOEXCEPT {return __table_.begin();} 13030b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13040b57cec5SDimitry Andric const_iterator end() const _NOEXCEPT {return __table_.end();} 13050b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13060b57cec5SDimitry Andric const_iterator cbegin() const _NOEXCEPT {return __table_.begin();} 13070b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13080b57cec5SDimitry Andric const_iterator cend() const _NOEXCEPT {return __table_.end();} 13090b57cec5SDimitry Andric 13100b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG 13110b57cec5SDimitry Andric template <class... _Args> 13120b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13130b57cec5SDimitry Andric iterator emplace(_Args&&... __args) 13140b57cec5SDimitry Andric {return __table_.__emplace_multi(_VSTD::forward<_Args>(__args)...);} 13150b57cec5SDimitry Andric template <class... _Args> 13160b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13170b57cec5SDimitry Andric iterator emplace_hint(const_iterator __p, _Args&&... __args) 13180b57cec5SDimitry Andric {return __table_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);} 13190b57cec5SDimitry Andric 13200b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13210b57cec5SDimitry Andric iterator insert(value_type&& __x) {return __table_.__insert_multi(_VSTD::move(__x));} 13220b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13230b57cec5SDimitry Andric iterator insert(const_iterator __p, value_type&& __x) 13240b57cec5SDimitry Andric {return __table_.__insert_multi(__p, _VSTD::move(__x));} 13250b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13260b57cec5SDimitry Andric void insert(initializer_list<value_type> __il) 13270b57cec5SDimitry Andric {insert(__il.begin(), __il.end());} 13280b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG 13290b57cec5SDimitry Andric 13300b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13310b57cec5SDimitry Andric iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);} 13320b57cec5SDimitry Andric 13330b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13340b57cec5SDimitry Andric iterator insert(const_iterator __p, const value_type& __x) 13350b57cec5SDimitry Andric {return __table_.__insert_multi(__p, __x);} 13360b57cec5SDimitry Andric 13370b57cec5SDimitry Andric template <class _InputIterator> 13380b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13390b57cec5SDimitry Andric void insert(_InputIterator __first, _InputIterator __last); 13400b57cec5SDimitry Andric 13410b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 14 13420b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13430b57cec5SDimitry Andric iterator insert(node_type&& __nh) 13440b57cec5SDimitry Andric { 13450b57cec5SDimitry Andric _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), 13460b57cec5SDimitry Andric "node_type with incompatible allocator passed to unordered_multiset::insert()"); 13470b57cec5SDimitry Andric return __table_.template __node_handle_insert_multi<node_type>( 13480b57cec5SDimitry Andric _VSTD::move(__nh)); 13490b57cec5SDimitry Andric } 13500b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13510b57cec5SDimitry Andric iterator insert(const_iterator __hint, node_type&& __nh) 13520b57cec5SDimitry Andric { 13530b57cec5SDimitry Andric _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), 13540b57cec5SDimitry Andric "node_type with incompatible allocator passed to unordered_multiset::insert()"); 13550b57cec5SDimitry Andric return __table_.template __node_handle_insert_multi<node_type>( 13560b57cec5SDimitry Andric __hint, _VSTD::move(__nh)); 13570b57cec5SDimitry Andric } 13580b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13590b57cec5SDimitry Andric node_type extract(const_iterator __position) 13600b57cec5SDimitry Andric { 13610b57cec5SDimitry Andric return __table_.template __node_handle_extract<node_type>( 13620b57cec5SDimitry Andric __position); 13630b57cec5SDimitry Andric } 13640b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13650b57cec5SDimitry Andric node_type extract(key_type const& __key) 13660b57cec5SDimitry Andric { 13670b57cec5SDimitry Andric return __table_.template __node_handle_extract<node_type>(__key); 13680b57cec5SDimitry Andric } 13690b57cec5SDimitry Andric 13700b57cec5SDimitry Andric template <class _H2, class _P2> 13710b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13720b57cec5SDimitry Andric void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>& __source) 13730b57cec5SDimitry Andric { 13740b57cec5SDimitry Andric _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 13750b57cec5SDimitry Andric "merging container with incompatible allocator"); 13760b57cec5SDimitry Andric return __table_.__node_handle_merge_multi(__source.__table_); 13770b57cec5SDimitry Andric } 13780b57cec5SDimitry Andric template <class _H2, class _P2> 13790b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13800b57cec5SDimitry Andric void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>&& __source) 13810b57cec5SDimitry Andric { 13820b57cec5SDimitry Andric _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 13830b57cec5SDimitry Andric "merging container with incompatible allocator"); 13840b57cec5SDimitry Andric return __table_.__node_handle_merge_multi(__source.__table_); 13850b57cec5SDimitry Andric } 13860b57cec5SDimitry Andric template <class _H2, class _P2> 13870b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13880b57cec5SDimitry Andric void merge(unordered_set<key_type, _H2, _P2, allocator_type>& __source) 13890b57cec5SDimitry Andric { 13900b57cec5SDimitry Andric _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 13910b57cec5SDimitry Andric "merging container with incompatible allocator"); 13920b57cec5SDimitry Andric return __table_.__node_handle_merge_multi(__source.__table_); 13930b57cec5SDimitry Andric } 13940b57cec5SDimitry Andric template <class _H2, class _P2> 13950b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13960b57cec5SDimitry Andric void merge(unordered_set<key_type, _H2, _P2, allocator_type>&& __source) 13970b57cec5SDimitry Andric { 13980b57cec5SDimitry Andric _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 13990b57cec5SDimitry Andric "merging container with incompatible allocator"); 14000b57cec5SDimitry Andric return __table_.__node_handle_merge_multi(__source.__table_); 14010b57cec5SDimitry Andric } 14020b57cec5SDimitry Andric#endif 14030b57cec5SDimitry Andric 14040b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14050b57cec5SDimitry Andric iterator erase(const_iterator __p) {return __table_.erase(__p);} 14060b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14070b57cec5SDimitry Andric size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);} 14080b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14090b57cec5SDimitry Andric iterator erase(const_iterator __first, const_iterator __last) 14100b57cec5SDimitry Andric {return __table_.erase(__first, __last);} 14110b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14120b57cec5SDimitry Andric void clear() _NOEXCEPT {__table_.clear();} 14130b57cec5SDimitry Andric 14140b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14150b57cec5SDimitry Andric void swap(unordered_multiset& __u) 14160b57cec5SDimitry Andric _NOEXCEPT_(__is_nothrow_swappable<__table>::value) 14170b57cec5SDimitry Andric {__table_.swap(__u.__table_);} 14180b57cec5SDimitry Andric 14190b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14200b57cec5SDimitry Andric hasher hash_function() const {return __table_.hash_function();} 14210b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14220b57cec5SDimitry Andric key_equal key_eq() const {return __table_.key_eq();} 14230b57cec5SDimitry Andric 14240b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14250b57cec5SDimitry Andric iterator find(const key_type& __k) {return __table_.find(__k);} 14260b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14270b57cec5SDimitry Andric const_iterator find(const key_type& __k) const {return __table_.find(__k);} 1428e8d8bef9SDimitry Andric#if _LIBCPP_STD_VER > 17 1429349cc55cSDimitry Andric template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 1430e8d8bef9SDimitry Andric _LIBCPP_INLINE_VISIBILITY 1431349cc55cSDimitry Andric iterator find(const _K2& __k) {return __table_.find(__k);} 1432349cc55cSDimitry Andric template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 1433e8d8bef9SDimitry Andric _LIBCPP_INLINE_VISIBILITY 1434349cc55cSDimitry Andric const_iterator find(const _K2& __k) const {return __table_.find(__k);} 1435e8d8bef9SDimitry Andric#endif // _LIBCPP_STD_VER > 17 1436349cc55cSDimitry Andric 14370b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14380b57cec5SDimitry Andric size_type count(const key_type& __k) const {return __table_.__count_multi(__k);} 14390b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 17 1440349cc55cSDimitry Andric template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 1441e8d8bef9SDimitry Andric _LIBCPP_INLINE_VISIBILITY 1442349cc55cSDimitry Andric size_type count(const _K2& __k) const {return __table_.__count_multi(__k);} 1443e8d8bef9SDimitry Andric#endif // _LIBCPP_STD_VER > 17 1444349cc55cSDimitry Andric 1445e8d8bef9SDimitry Andric#if _LIBCPP_STD_VER > 17 14460b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14470b57cec5SDimitry Andric bool contains(const key_type& __k) const {return find(__k) != end();} 1448e8d8bef9SDimitry Andric 1449349cc55cSDimitry Andric template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 1450e8d8bef9SDimitry Andric _LIBCPP_INLINE_VISIBILITY 1451349cc55cSDimitry Andric bool contains(const _K2& __k) const {return find(__k) != end();} 14520b57cec5SDimitry Andric#endif // _LIBCPP_STD_VER > 17 1453349cc55cSDimitry Andric 14540b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14550b57cec5SDimitry Andric pair<iterator, iterator> equal_range(const key_type& __k) 14560b57cec5SDimitry Andric {return __table_.__equal_range_multi(__k);} 14570b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14580b57cec5SDimitry Andric pair<const_iterator, const_iterator> equal_range(const key_type& __k) const 14590b57cec5SDimitry Andric {return __table_.__equal_range_multi(__k);} 1460e8d8bef9SDimitry Andric#if _LIBCPP_STD_VER > 17 1461349cc55cSDimitry Andric template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 1462e8d8bef9SDimitry Andric _LIBCPP_INLINE_VISIBILITY 1463349cc55cSDimitry Andric pair<iterator, iterator> equal_range(const _K2& __k) 1464349cc55cSDimitry Andric {return __table_.__equal_range_multi(__k);} 1465349cc55cSDimitry Andric template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 1466e8d8bef9SDimitry Andric _LIBCPP_INLINE_VISIBILITY 1467349cc55cSDimitry Andric pair<const_iterator, const_iterator> equal_range(const _K2& __k) const 1468349cc55cSDimitry Andric {return __table_.__equal_range_multi(__k);} 1469e8d8bef9SDimitry Andric#endif // _LIBCPP_STD_VER > 17 14700b57cec5SDimitry Andric 14710b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14720b57cec5SDimitry Andric size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();} 14730b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14740b57cec5SDimitry Andric size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();} 14750b57cec5SDimitry Andric 14760b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14770b57cec5SDimitry Andric size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);} 14780b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14790b57cec5SDimitry Andric size_type bucket(const key_type& __k) const {return __table_.bucket(__k);} 14800b57cec5SDimitry Andric 14810b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14820b57cec5SDimitry Andric local_iterator begin(size_type __n) {return __table_.begin(__n);} 14830b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14840b57cec5SDimitry Andric local_iterator end(size_type __n) {return __table_.end(__n);} 14850b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14860b57cec5SDimitry Andric const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);} 14870b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14880b57cec5SDimitry Andric const_local_iterator end(size_type __n) const {return __table_.cend(__n);} 14890b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14900b57cec5SDimitry Andric const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);} 14910b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14920b57cec5SDimitry Andric const_local_iterator cend(size_type __n) const {return __table_.cend(__n);} 14930b57cec5SDimitry Andric 14940b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14950b57cec5SDimitry Andric float load_factor() const _NOEXCEPT {return __table_.load_factor();} 14960b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14970b57cec5SDimitry Andric float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();} 14980b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14990b57cec5SDimitry Andric void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);} 15000b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 1501753f127fSDimitry Andric void rehash(size_type __n) {__table_.__rehash_multi(__n);} 15020b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 1503753f127fSDimitry Andric void reserve(size_type __n) {__table_.__reserve_multi(__n);} 15040b57cec5SDimitry Andric 150581ad6265SDimitry Andric#ifdef _LIBCPP_ENABLE_DEBUG_MODE 15060b57cec5SDimitry Andric 15070b57cec5SDimitry Andric bool __dereferenceable(const const_iterator* __i) const 15080b57cec5SDimitry Andric {return __table_.__dereferenceable(__i);} 15090b57cec5SDimitry Andric bool __decrementable(const const_iterator* __i) const 15100b57cec5SDimitry Andric {return __table_.__decrementable(__i);} 15110b57cec5SDimitry Andric bool __addable(const const_iterator* __i, ptrdiff_t __n) const 15120b57cec5SDimitry Andric {return __table_.__addable(__i, __n);} 15130b57cec5SDimitry Andric bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const 15140b57cec5SDimitry Andric {return __table_.__addable(__i, __n);} 15150b57cec5SDimitry Andric 151681ad6265SDimitry Andric#endif // _LIBCPP_ENABLE_DEBUG_MODE 15170b57cec5SDimitry Andric 15180b57cec5SDimitry Andric}; 15190b57cec5SDimitry Andric 1520349cc55cSDimitry Andric#if _LIBCPP_STD_VER >= 17 15210b57cec5SDimitry Andrictemplate<class _InputIterator, 15220b57cec5SDimitry Andric class _Hash = hash<__iter_value_type<_InputIterator>>, 15230b57cec5SDimitry Andric class _Pred = equal_to<__iter_value_type<_InputIterator>>, 15240b57cec5SDimitry Andric class _Allocator = allocator<__iter_value_type<_InputIterator>>, 1525349cc55cSDimitry Andric class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, 1526349cc55cSDimitry Andric class = enable_if_t<!__is_allocator<_Hash>::value>, 1527349cc55cSDimitry Andric class = enable_if_t<!is_integral<_Hash>::value>, 1528349cc55cSDimitry Andric class = enable_if_t<!__is_allocator<_Pred>::value>, 1529349cc55cSDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value>> 15300b57cec5SDimitry Andricunordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0, 15310b57cec5SDimitry Andric _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) 15320b57cec5SDimitry Andric -> unordered_multiset<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>; 15330b57cec5SDimitry Andric 15340b57cec5SDimitry Andrictemplate<class _Tp, class _Hash = hash<_Tp>, 15350b57cec5SDimitry Andric class _Pred = equal_to<_Tp>, class _Allocator = allocator<_Tp>, 1536349cc55cSDimitry Andric class = enable_if_t<!__is_allocator<_Hash>::value>, 1537349cc55cSDimitry Andric class = enable_if_t<!is_integral<_Hash>::value>, 1538349cc55cSDimitry Andric class = enable_if_t<!__is_allocator<_Pred>::value>, 1539349cc55cSDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value>> 15400b57cec5SDimitry Andricunordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type = 0, 15410b57cec5SDimitry Andric _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) 15420b57cec5SDimitry Andric -> unordered_multiset<_Tp, _Hash, _Pred, _Allocator>; 15430b57cec5SDimitry Andric 15440b57cec5SDimitry Andrictemplate<class _InputIterator, class _Allocator, 1545349cc55cSDimitry Andric class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, 1546349cc55cSDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value>> 15470b57cec5SDimitry Andricunordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator) 15480b57cec5SDimitry Andric -> unordered_multiset<__iter_value_type<_InputIterator>, 15490b57cec5SDimitry Andric hash<__iter_value_type<_InputIterator>>, 15500b57cec5SDimitry Andric equal_to<__iter_value_type<_InputIterator>>, 15510b57cec5SDimitry Andric _Allocator>; 15520b57cec5SDimitry Andric 15530b57cec5SDimitry Andrictemplate<class _InputIterator, class _Hash, class _Allocator, 1554349cc55cSDimitry Andric class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, 1555349cc55cSDimitry Andric class = enable_if_t<!__is_allocator<_Hash>::value>, 1556349cc55cSDimitry Andric class = enable_if_t<!is_integral<_Hash>::value>, 1557349cc55cSDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value>> 15580b57cec5SDimitry Andricunordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, 15590b57cec5SDimitry Andric _Hash, _Allocator) 15600b57cec5SDimitry Andric -> unordered_multiset<__iter_value_type<_InputIterator>, _Hash, 15610b57cec5SDimitry Andric equal_to<__iter_value_type<_InputIterator>>, 15620b57cec5SDimitry Andric _Allocator>; 15630b57cec5SDimitry Andric 15640b57cec5SDimitry Andrictemplate<class _Tp, class _Allocator, 1565349cc55cSDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value>> 15660b57cec5SDimitry Andricunordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Allocator) 15670b57cec5SDimitry Andric -> unordered_multiset<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>; 15680b57cec5SDimitry Andric 15690b57cec5SDimitry Andrictemplate<class _Tp, class _Hash, class _Allocator, 1570349cc55cSDimitry Andric class = enable_if_t<!__is_allocator<_Hash>::value>, 1571349cc55cSDimitry Andric class = enable_if_t<!is_integral<_Hash>::value>, 1572349cc55cSDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value>> 15730b57cec5SDimitry Andricunordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator) 15740b57cec5SDimitry Andric -> unordered_multiset<_Tp, _Hash, equal_to<_Tp>, _Allocator>; 15750b57cec5SDimitry Andric#endif 15760b57cec5SDimitry Andric 15770b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 15780b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 15790b57cec5SDimitry Andric size_type __n, const hasher& __hf, const key_equal& __eql) 15800b57cec5SDimitry Andric : __table_(__hf, __eql) 15810b57cec5SDimitry Andric{ 158204eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 1583753f127fSDimitry Andric __table_.__rehash_multi(__n); 15840b57cec5SDimitry Andric} 15850b57cec5SDimitry Andric 15860b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 15870b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 15880b57cec5SDimitry Andric size_type __n, const hasher& __hf, const key_equal& __eql, 15890b57cec5SDimitry Andric const allocator_type& __a) 15900b57cec5SDimitry Andric : __table_(__hf, __eql, __a) 15910b57cec5SDimitry Andric{ 159204eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 1593753f127fSDimitry Andric __table_.__rehash_multi(__n); 15940b57cec5SDimitry Andric} 15950b57cec5SDimitry Andric 15960b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 15970b57cec5SDimitry Andrictemplate <class _InputIterator> 15980b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 15990b57cec5SDimitry Andric _InputIterator __first, _InputIterator __last) 16000b57cec5SDimitry Andric{ 160104eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 16020b57cec5SDimitry Andric insert(__first, __last); 16030b57cec5SDimitry Andric} 16040b57cec5SDimitry Andric 16050b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 16060b57cec5SDimitry Andrictemplate <class _InputIterator> 16070b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 16080b57cec5SDimitry Andric _InputIterator __first, _InputIterator __last, size_type __n, 16090b57cec5SDimitry Andric const hasher& __hf, const key_equal& __eql) 16100b57cec5SDimitry Andric : __table_(__hf, __eql) 16110b57cec5SDimitry Andric{ 161204eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 1613753f127fSDimitry Andric __table_.__rehash_multi(__n); 16140b57cec5SDimitry Andric insert(__first, __last); 16150b57cec5SDimitry Andric} 16160b57cec5SDimitry Andric 16170b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 16180b57cec5SDimitry Andrictemplate <class _InputIterator> 16190b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 16200b57cec5SDimitry Andric _InputIterator __first, _InputIterator __last, size_type __n, 16210b57cec5SDimitry Andric const hasher& __hf, const key_equal& __eql, const allocator_type& __a) 16220b57cec5SDimitry Andric : __table_(__hf, __eql, __a) 16230b57cec5SDimitry Andric{ 162404eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 1625753f127fSDimitry Andric __table_.__rehash_multi(__n); 16260b57cec5SDimitry Andric insert(__first, __last); 16270b57cec5SDimitry Andric} 16280b57cec5SDimitry Andric 16290b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 16300b57cec5SDimitry Andricinline 16310b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 16320b57cec5SDimitry Andric const allocator_type& __a) 16330b57cec5SDimitry Andric : __table_(__a) 16340b57cec5SDimitry Andric{ 163504eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 16360b57cec5SDimitry Andric} 16370b57cec5SDimitry Andric 16380b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 16390b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 16400b57cec5SDimitry Andric const unordered_multiset& __u) 16410b57cec5SDimitry Andric : __table_(__u.__table_) 16420b57cec5SDimitry Andric{ 164304eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 1644753f127fSDimitry Andric __table_.__rehash_multi(__u.bucket_count()); 16450b57cec5SDimitry Andric insert(__u.begin(), __u.end()); 16460b57cec5SDimitry Andric} 16470b57cec5SDimitry Andric 16480b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 16490b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 16500b57cec5SDimitry Andric const unordered_multiset& __u, const allocator_type& __a) 16510b57cec5SDimitry Andric : __table_(__u.__table_, __a) 16520b57cec5SDimitry Andric{ 165304eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 1654753f127fSDimitry Andric __table_.__rehash_multi(__u.bucket_count()); 16550b57cec5SDimitry Andric insert(__u.begin(), __u.end()); 16560b57cec5SDimitry Andric} 16570b57cec5SDimitry Andric 16580b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG 16590b57cec5SDimitry Andric 16600b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 16610b57cec5SDimitry Andricinline 16620b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 16630b57cec5SDimitry Andric unordered_multiset&& __u) 16640b57cec5SDimitry Andric _NOEXCEPT_(is_nothrow_move_constructible<__table>::value) 16650b57cec5SDimitry Andric : __table_(_VSTD::move(__u.__table_)) 16660b57cec5SDimitry Andric{ 166704eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 166881ad6265SDimitry Andric std::__debug_db_swap(this, std::addressof(__u)); 16690b57cec5SDimitry Andric} 16700b57cec5SDimitry Andric 16710b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 16720b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 16730b57cec5SDimitry Andric unordered_multiset&& __u, const allocator_type& __a) 16740b57cec5SDimitry Andric : __table_(_VSTD::move(__u.__table_), __a) 16750b57cec5SDimitry Andric{ 167604eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 16770b57cec5SDimitry Andric if (__a != __u.get_allocator()) 16780b57cec5SDimitry Andric { 16790b57cec5SDimitry Andric iterator __i = __u.begin(); 16800b57cec5SDimitry Andric while (__u.size() != 0) 16810b57cec5SDimitry Andric __table_.__insert_multi(_VSTD::move(__u.__table_.remove(__i++)->__value_)); 16820b57cec5SDimitry Andric } 16830b57cec5SDimitry Andric else 168481ad6265SDimitry Andric std::__debug_db_swap(this, std::addressof(__u)); 16850b57cec5SDimitry Andric} 16860b57cec5SDimitry Andric 16870b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 16880b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 16890b57cec5SDimitry Andric initializer_list<value_type> __il) 16900b57cec5SDimitry Andric{ 169104eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 16920b57cec5SDimitry Andric insert(__il.begin(), __il.end()); 16930b57cec5SDimitry Andric} 16940b57cec5SDimitry Andric 16950b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 16960b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 16970b57cec5SDimitry Andric initializer_list<value_type> __il, size_type __n, const hasher& __hf, 16980b57cec5SDimitry Andric const key_equal& __eql) 16990b57cec5SDimitry Andric : __table_(__hf, __eql) 17000b57cec5SDimitry Andric{ 170104eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 1702753f127fSDimitry Andric __table_.__rehash_multi(__n); 17030b57cec5SDimitry Andric insert(__il.begin(), __il.end()); 17040b57cec5SDimitry Andric} 17050b57cec5SDimitry Andric 17060b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 17070b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 17080b57cec5SDimitry Andric initializer_list<value_type> __il, size_type __n, const hasher& __hf, 17090b57cec5SDimitry Andric const key_equal& __eql, const allocator_type& __a) 17100b57cec5SDimitry Andric : __table_(__hf, __eql, __a) 17110b57cec5SDimitry Andric{ 171204eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 1713753f127fSDimitry Andric __table_.__rehash_multi(__n); 17140b57cec5SDimitry Andric insert(__il.begin(), __il.end()); 17150b57cec5SDimitry Andric} 17160b57cec5SDimitry Andric 17170b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 17180b57cec5SDimitry Andricinline 17190b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>& 17200b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=( 17210b57cec5SDimitry Andric unordered_multiset&& __u) 17220b57cec5SDimitry Andric _NOEXCEPT_(is_nothrow_move_assignable<__table>::value) 17230b57cec5SDimitry Andric{ 17240b57cec5SDimitry Andric __table_ = _VSTD::move(__u.__table_); 17250b57cec5SDimitry Andric return *this; 17260b57cec5SDimitry Andric} 17270b57cec5SDimitry Andric 17280b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 17290b57cec5SDimitry Andricinline 17300b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>& 17310b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=( 17320b57cec5SDimitry Andric initializer_list<value_type> __il) 17330b57cec5SDimitry Andric{ 17340b57cec5SDimitry Andric __table_.__assign_multi(__il.begin(), __il.end()); 17350b57cec5SDimitry Andric return *this; 17360b57cec5SDimitry Andric} 17370b57cec5SDimitry Andric 17380b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG 17390b57cec5SDimitry Andric 17400b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 17410b57cec5SDimitry Andrictemplate <class _InputIterator> 17420b57cec5SDimitry Andricinline 17430b57cec5SDimitry Andricvoid 17440b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, 17450b57cec5SDimitry Andric _InputIterator __last) 17460b57cec5SDimitry Andric{ 17470b57cec5SDimitry Andric for (; __first != __last; ++__first) 17480b57cec5SDimitry Andric __table_.__insert_multi(*__first); 17490b57cec5SDimitry Andric} 17500b57cec5SDimitry Andric 17510b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 17520b57cec5SDimitry Andricinline _LIBCPP_INLINE_VISIBILITY 17530b57cec5SDimitry Andricvoid 17540b57cec5SDimitry Andricswap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, 17550b57cec5SDimitry Andric unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) 17560b57cec5SDimitry Andric _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) 17570b57cec5SDimitry Andric{ 17580b57cec5SDimitry Andric __x.swap(__y); 17590b57cec5SDimitry Andric} 17600b57cec5SDimitry Andric 17610b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 17 17625ffd83dbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc, 17635ffd83dbSDimitry Andric class _Predicate> 17640b57cec5SDimitry Andricinline _LIBCPP_INLINE_VISIBILITY 17655ffd83dbSDimitry Andric typename unordered_multiset<_Value, _Hash, _Pred, _Alloc>::size_type 17665ffd83dbSDimitry Andric erase_if(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __c, 17675ffd83dbSDimitry Andric _Predicate __pred) { 1768fe6060f1SDimitry Andric return _VSTD::__libcpp_erase_if_container(__c, __pred); 17695ffd83dbSDimitry Andric} 17700b57cec5SDimitry Andric#endif 17710b57cec5SDimitry Andric 17720b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 1773*bdd1243dSDimitry Andric_LIBCPP_HIDE_FROM_ABI bool 17740b57cec5SDimitry Andricoperator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, 17750b57cec5SDimitry Andric const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) 17760b57cec5SDimitry Andric{ 17770b57cec5SDimitry Andric if (__x.size() != __y.size()) 17780b57cec5SDimitry Andric return false; 17790b57cec5SDimitry Andric typedef typename unordered_multiset<_Value, _Hash, _Pred, _Alloc>::const_iterator 17800b57cec5SDimitry Andric const_iterator; 17810b57cec5SDimitry Andric typedef pair<const_iterator, const_iterator> _EqRng; 17820b57cec5SDimitry Andric for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;) 17830b57cec5SDimitry Andric { 17840b57cec5SDimitry Andric _EqRng __xeq = __x.equal_range(*__i); 17850b57cec5SDimitry Andric _EqRng __yeq = __y.equal_range(*__i); 17860b57cec5SDimitry Andric if (_VSTD::distance(__xeq.first, __xeq.second) != 17870b57cec5SDimitry Andric _VSTD::distance(__yeq.first, __yeq.second) || 17880b57cec5SDimitry Andric !_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first)) 17890b57cec5SDimitry Andric return false; 17900b57cec5SDimitry Andric __i = __xeq.second; 17910b57cec5SDimitry Andric } 17920b57cec5SDimitry Andric return true; 17930b57cec5SDimitry Andric} 17940b57cec5SDimitry Andric 17950b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 17960b57cec5SDimitry Andricinline _LIBCPP_INLINE_VISIBILITY 17970b57cec5SDimitry Andricbool 17980b57cec5SDimitry Andricoperator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, 17990b57cec5SDimitry Andric const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) 18000b57cec5SDimitry Andric{ 18010b57cec5SDimitry Andric return !(__x == __y); 18020b57cec5SDimitry Andric} 18030b57cec5SDimitry Andric 18040b57cec5SDimitry Andric_LIBCPP_END_NAMESPACE_STD 18050b57cec5SDimitry Andric 1806*bdd1243dSDimitry Andric#if _LIBCPP_STD_VER > 14 1807*bdd1243dSDimitry Andric_LIBCPP_BEGIN_NAMESPACE_STD 1808*bdd1243dSDimitry Andricnamespace pmr { 1809*bdd1243dSDimitry Andrictemplate <class _KeyT, class _HashT = std::hash<_KeyT>, class _PredT = std::equal_to<_KeyT>> 1810*bdd1243dSDimitry Andricusing unordered_set = std::unordered_set<_KeyT, _HashT, _PredT, polymorphic_allocator<_KeyT>>; 1811*bdd1243dSDimitry Andric 1812*bdd1243dSDimitry Andrictemplate <class _KeyT, class _HashT = std::hash<_KeyT>, class _PredT = std::equal_to<_KeyT>> 1813*bdd1243dSDimitry Andricusing unordered_multiset = std::unordered_multiset<_KeyT, _HashT, _PredT, polymorphic_allocator<_KeyT>>; 1814*bdd1243dSDimitry Andric} // namespace pmr 1815*bdd1243dSDimitry Andric_LIBCPP_END_NAMESPACE_STD 1816*bdd1243dSDimitry Andric#endif 1817*bdd1243dSDimitry Andric 1818*bdd1243dSDimitry Andric#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 1819*bdd1243dSDimitry Andric# include <concepts> 1820*bdd1243dSDimitry Andric# include <functional> 1821*bdd1243dSDimitry Andric# include <iterator> 1822*bdd1243dSDimitry Andric#endif 1823*bdd1243dSDimitry Andric 18240b57cec5SDimitry Andric#endif // _LIBCPP_UNORDERED_SET 1825