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 462*81ad6265SDimitry Andric#include <__algorithm/is_permutation.h> 463*81ad6265SDimitry 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> 467*81ad6265SDimitry Andric#include <__functional/operations.h> 4680b57cec5SDimitry Andric#include <__hash_table> 469*81ad6265SDimitry Andric#include <__iterator/distance.h> 470*81ad6265SDimitry Andric#include <__iterator/erase_if_container.h> 471*81ad6265SDimitry Andric#include <__iterator/iterator_traits.h> 47204eeddc0SDimitry Andric#include <__memory/addressof.h> 4730b57cec5SDimitry Andric#include <__node_handle> 474fe6060f1SDimitry Andric#include <__utility/forward.h> 4750b57cec5SDimitry Andric#include <version> 4760b57cec5SDimitry Andric 477*81ad6265SDimitry Andric#ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES 478*81ad6265SDimitry Andric# include <functional> 479*81ad6265SDimitry Andric# include <iterator> 480*81ad6265SDimitry Andric#endif 481*81ad6265SDimitry Andric 482*81ad6265SDimitry Andric// standard-mandated includes 483*81ad6265SDimitry Andric 484*81ad6265SDimitry Andric// [iterator.range] 485*81ad6265SDimitry Andric#include <__iterator/access.h> 486*81ad6265SDimitry Andric#include <__iterator/data.h> 487*81ad6265SDimitry Andric#include <__iterator/empty.h> 488*81ad6265SDimitry Andric#include <__iterator/reverse_access.h> 489*81ad6265SDimitry Andric#include <__iterator/size.h> 490*81ad6265SDimitry Andric 491*81ad6265SDimitry Andric// [unord.set.syn] 492*81ad6265SDimitry Andric#include <compare> 493*81ad6265SDimitry Andric#include <initializer_list> 494*81ad6265SDimitry Andric 4950b57cec5SDimitry Andric#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 4960b57cec5SDimitry Andric# pragma GCC system_header 4970b57cec5SDimitry Andric#endif 4980b57cec5SDimitry Andric 4990b57cec5SDimitry Andric_LIBCPP_BEGIN_NAMESPACE_STD 5000b57cec5SDimitry Andric 5010b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 5020b57cec5SDimitry Andricclass unordered_multiset; 5030b57cec5SDimitry Andric 5040b57cec5SDimitry Andrictemplate <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>, 5050b57cec5SDimitry Andric class _Alloc = allocator<_Value> > 5060b57cec5SDimitry Andricclass _LIBCPP_TEMPLATE_VIS unordered_set 5070b57cec5SDimitry Andric{ 5080b57cec5SDimitry Andricpublic: 5090b57cec5SDimitry Andric // types 5100b57cec5SDimitry Andric typedef _Value key_type; 5110b57cec5SDimitry Andric typedef key_type value_type; 512*81ad6265SDimitry Andric typedef __type_identity_t<_Hash> hasher; 513*81ad6265SDimitry Andric typedef __type_identity_t<_Pred> key_equal; 514*81ad6265SDimitry Andric typedef __type_identity_t<_Alloc> allocator_type; 5150b57cec5SDimitry Andric typedef value_type& reference; 5160b57cec5SDimitry Andric typedef const value_type& const_reference; 5170b57cec5SDimitry Andric static_assert((is_same<value_type, typename allocator_type::value_type>::value), 5180b57cec5SDimitry Andric "Invalid allocator::value_type"); 5190b57cec5SDimitry Andric 5200b57cec5SDimitry Andricprivate: 5210b57cec5SDimitry Andric typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table; 5220b57cec5SDimitry Andric 5230b57cec5SDimitry Andric __table __table_; 5240b57cec5SDimitry Andric 5250b57cec5SDimitry Andricpublic: 5260b57cec5SDimitry Andric typedef typename __table::pointer pointer; 5270b57cec5SDimitry Andric typedef typename __table::const_pointer const_pointer; 5280b57cec5SDimitry Andric typedef typename __table::size_type size_type; 5290b57cec5SDimitry Andric typedef typename __table::difference_type difference_type; 5300b57cec5SDimitry Andric 5310b57cec5SDimitry Andric typedef typename __table::const_iterator iterator; 5320b57cec5SDimitry Andric typedef typename __table::const_iterator const_iterator; 5330b57cec5SDimitry Andric typedef typename __table::const_local_iterator local_iterator; 5340b57cec5SDimitry Andric typedef typename __table::const_local_iterator const_local_iterator; 5350b57cec5SDimitry Andric 5360b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 14 5370b57cec5SDimitry Andric typedef __set_node_handle<typename __table::__node, allocator_type> node_type; 5380b57cec5SDimitry Andric typedef __insert_return_type<iterator, node_type> insert_return_type; 5390b57cec5SDimitry Andric#endif 5400b57cec5SDimitry Andric 5410b57cec5SDimitry Andric template <class _Value2, class _Hash2, class _Pred2, class _Alloc2> 5420b57cec5SDimitry Andric friend class _LIBCPP_TEMPLATE_VIS unordered_set; 5430b57cec5SDimitry Andric template <class _Value2, class _Hash2, class _Pred2, class _Alloc2> 5440b57cec5SDimitry Andric friend class _LIBCPP_TEMPLATE_VIS unordered_multiset; 5450b57cec5SDimitry Andric 5460b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 5470b57cec5SDimitry Andric unordered_set() 5480b57cec5SDimitry Andric _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) 5490b57cec5SDimitry Andric { 55004eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 5510b57cec5SDimitry Andric } 5520b57cec5SDimitry Andric explicit unordered_set(size_type __n, const hasher& __hf = hasher(), 5530b57cec5SDimitry Andric const key_equal& __eql = key_equal()); 5540b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 11 5550b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 5560b57cec5SDimitry Andric unordered_set(size_type __n, const allocator_type& __a) 5570b57cec5SDimitry Andric : unordered_set(__n, hasher(), key_equal(), __a) {} 5580b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 5590b57cec5SDimitry Andric unordered_set(size_type __n, const hasher& __hf, const allocator_type& __a) 5600b57cec5SDimitry Andric : unordered_set(__n, __hf, key_equal(), __a) {} 5610b57cec5SDimitry Andric#endif 5620b57cec5SDimitry Andric unordered_set(size_type __n, const hasher& __hf, const key_equal& __eql, 5630b57cec5SDimitry Andric const allocator_type& __a); 5640b57cec5SDimitry Andric template <class _InputIterator> 5650b57cec5SDimitry Andric unordered_set(_InputIterator __first, _InputIterator __last); 5660b57cec5SDimitry Andric template <class _InputIterator> 5670b57cec5SDimitry Andric unordered_set(_InputIterator __first, _InputIterator __last, 5680b57cec5SDimitry Andric size_type __n, const hasher& __hf = hasher(), 5690b57cec5SDimitry Andric const key_equal& __eql = key_equal()); 5700b57cec5SDimitry Andric template <class _InputIterator> 5710b57cec5SDimitry Andric unordered_set(_InputIterator __first, _InputIterator __last, 5720b57cec5SDimitry Andric size_type __n, const hasher& __hf, const key_equal& __eql, 5730b57cec5SDimitry Andric const allocator_type& __a); 5740b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 11 5750b57cec5SDimitry Andric template <class _InputIterator> 5760b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 5770b57cec5SDimitry Andric unordered_set(_InputIterator __first, _InputIterator __last, 5780b57cec5SDimitry Andric size_type __n, const allocator_type& __a) 5790b57cec5SDimitry Andric : unordered_set(__first, __last, __n, hasher(), key_equal(), __a) {} 5800b57cec5SDimitry Andric template <class _InputIterator> 5810b57cec5SDimitry Andric unordered_set(_InputIterator __first, _InputIterator __last, 5820b57cec5SDimitry Andric size_type __n, const hasher& __hf, const allocator_type& __a) 5830b57cec5SDimitry Andric : unordered_set(__first, __last, __n, __hf, key_equal(), __a) {} 5840b57cec5SDimitry Andric#endif 5850b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 5860b57cec5SDimitry Andric explicit unordered_set(const allocator_type& __a); 5870b57cec5SDimitry Andric unordered_set(const unordered_set& __u); 5880b57cec5SDimitry Andric unordered_set(const unordered_set& __u, const allocator_type& __a); 5890b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG 5900b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 5910b57cec5SDimitry Andric unordered_set(unordered_set&& __u) 5920b57cec5SDimitry Andric _NOEXCEPT_(is_nothrow_move_constructible<__table>::value); 5930b57cec5SDimitry Andric unordered_set(unordered_set&& __u, const allocator_type& __a); 5940b57cec5SDimitry Andric unordered_set(initializer_list<value_type> __il); 5950b57cec5SDimitry Andric unordered_set(initializer_list<value_type> __il, size_type __n, 5960b57cec5SDimitry Andric const hasher& __hf = hasher(), 5970b57cec5SDimitry Andric const key_equal& __eql = key_equal()); 5980b57cec5SDimitry Andric unordered_set(initializer_list<value_type> __il, size_type __n, 5990b57cec5SDimitry Andric const hasher& __hf, const key_equal& __eql, 6000b57cec5SDimitry Andric const allocator_type& __a); 6010b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 11 6020b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 6030b57cec5SDimitry Andric unordered_set(initializer_list<value_type> __il, size_type __n, 6040b57cec5SDimitry Andric const allocator_type& __a) 6050b57cec5SDimitry Andric : unordered_set(__il, __n, hasher(), key_equal(), __a) {} 6060b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 6070b57cec5SDimitry Andric unordered_set(initializer_list<value_type> __il, size_type __n, 6080b57cec5SDimitry Andric const hasher& __hf, const allocator_type& __a) 6090b57cec5SDimitry Andric : unordered_set(__il, __n, __hf, key_equal(), __a) {} 6100b57cec5SDimitry Andric#endif 6110b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG 6120b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6130b57cec5SDimitry Andric ~unordered_set() { 6140b57cec5SDimitry Andric static_assert(sizeof(__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), ""); 6150b57cec5SDimitry Andric } 6160b57cec5SDimitry Andric 6170b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6180b57cec5SDimitry Andric unordered_set& operator=(const unordered_set& __u) 6190b57cec5SDimitry Andric { 6200b57cec5SDimitry Andric __table_ = __u.__table_; 6210b57cec5SDimitry Andric return *this; 6220b57cec5SDimitry Andric } 6230b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG 6240b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6250b57cec5SDimitry Andric unordered_set& operator=(unordered_set&& __u) 6260b57cec5SDimitry Andric _NOEXCEPT_(is_nothrow_move_assignable<__table>::value); 6270b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6280b57cec5SDimitry Andric unordered_set& operator=(initializer_list<value_type> __il); 6290b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG 6300b57cec5SDimitry Andric 6310b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6320b57cec5SDimitry Andric allocator_type get_allocator() const _NOEXCEPT 6330b57cec5SDimitry Andric {return allocator_type(__table_.__node_alloc());} 6340b57cec5SDimitry Andric 6350b57cec5SDimitry Andric _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY 6360b57cec5SDimitry Andric bool empty() const _NOEXCEPT {return __table_.size() == 0;} 6370b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6380b57cec5SDimitry Andric size_type size() const _NOEXCEPT {return __table_.size();} 6390b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6400b57cec5SDimitry Andric size_type max_size() const _NOEXCEPT {return __table_.max_size();} 6410b57cec5SDimitry Andric 6420b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6430b57cec5SDimitry Andric iterator begin() _NOEXCEPT {return __table_.begin();} 6440b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6450b57cec5SDimitry Andric iterator end() _NOEXCEPT {return __table_.end();} 6460b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6470b57cec5SDimitry Andric const_iterator begin() const _NOEXCEPT {return __table_.begin();} 6480b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6490b57cec5SDimitry Andric const_iterator end() const _NOEXCEPT {return __table_.end();} 6500b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6510b57cec5SDimitry Andric const_iterator cbegin() const _NOEXCEPT {return __table_.begin();} 6520b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6530b57cec5SDimitry Andric const_iterator cend() const _NOEXCEPT {return __table_.end();} 6540b57cec5SDimitry Andric 6550b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG 6560b57cec5SDimitry Andric template <class... _Args> 6570b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6580b57cec5SDimitry Andric pair<iterator, bool> emplace(_Args&&... __args) 6590b57cec5SDimitry Andric {return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...);} 6600b57cec5SDimitry Andric template <class... _Args> 6610b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 662*81ad6265SDimitry Andric iterator emplace_hint(const_iterator __p, _Args&&... __args) { 663*81ad6265SDimitry Andric _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__p)) == this, 6640b57cec5SDimitry Andric "unordered_set::emplace_hint(const_iterator, args...) called with an iterator not" 6650b57cec5SDimitry Andric " referring to this unordered_set"); 666*81ad6265SDimitry Andric (void)__p; 667*81ad6265SDimitry Andric return __table_.__emplace_unique(std::forward<_Args>(__args)...).first; 6680b57cec5SDimitry Andric } 6690b57cec5SDimitry Andric 6700b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6710b57cec5SDimitry Andric pair<iterator, bool> insert(value_type&& __x) 6720b57cec5SDimitry Andric {return __table_.__insert_unique(_VSTD::move(__x));} 6730b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 674*81ad6265SDimitry Andric iterator insert(const_iterator __p, value_type&& __x) { 675*81ad6265SDimitry Andric _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__p)) == this, 6760b57cec5SDimitry Andric "unordered_set::insert(const_iterator, value_type&&) called with an iterator not" 6770b57cec5SDimitry Andric " referring to this unordered_set"); 678*81ad6265SDimitry Andric (void)__p; 679*81ad6265SDimitry Andric return insert(std::move(__x)).first; 6800b57cec5SDimitry Andric } 681*81ad6265SDimitry Andric 6820b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6830b57cec5SDimitry Andric void insert(initializer_list<value_type> __il) 6840b57cec5SDimitry Andric {insert(__il.begin(), __il.end());} 6850b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG 6860b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6870b57cec5SDimitry Andric pair<iterator, bool> insert(const value_type& __x) 6880b57cec5SDimitry Andric {return __table_.__insert_unique(__x);} 6890b57cec5SDimitry Andric 6900b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 691*81ad6265SDimitry Andric iterator insert(const_iterator __p, const value_type& __x) { 692*81ad6265SDimitry Andric _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__p)) == this, 6930b57cec5SDimitry Andric "unordered_set::insert(const_iterator, const value_type&) called with an iterator not" 6940b57cec5SDimitry Andric " referring to this unordered_set"); 695*81ad6265SDimitry Andric (void)__p; 6960b57cec5SDimitry Andric return insert(__x).first; 6970b57cec5SDimitry Andric } 6980b57cec5SDimitry Andric template <class _InputIterator> 6990b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7000b57cec5SDimitry Andric void insert(_InputIterator __first, _InputIterator __last); 7010b57cec5SDimitry Andric 7020b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7030b57cec5SDimitry Andric iterator erase(const_iterator __p) {return __table_.erase(__p);} 7040b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7050b57cec5SDimitry Andric size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);} 7060b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7070b57cec5SDimitry Andric iterator erase(const_iterator __first, const_iterator __last) 7080b57cec5SDimitry Andric {return __table_.erase(__first, __last);} 7090b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7100b57cec5SDimitry Andric void clear() _NOEXCEPT {__table_.clear();} 7110b57cec5SDimitry Andric 7120b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 14 7130b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7140b57cec5SDimitry Andric insert_return_type insert(node_type&& __nh) 7150b57cec5SDimitry Andric { 7160b57cec5SDimitry Andric _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), 7170b57cec5SDimitry Andric "node_type with incompatible allocator passed to unordered_set::insert()"); 7180b57cec5SDimitry Andric return __table_.template __node_handle_insert_unique< 7190b57cec5SDimitry Andric node_type, insert_return_type>(_VSTD::move(__nh)); 7200b57cec5SDimitry Andric } 7210b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7220b57cec5SDimitry Andric iterator insert(const_iterator __h, node_type&& __nh) 7230b57cec5SDimitry Andric { 7240b57cec5SDimitry Andric _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), 7250b57cec5SDimitry Andric "node_type with incompatible allocator passed to unordered_set::insert()"); 7260b57cec5SDimitry Andric return __table_.template __node_handle_insert_unique<node_type>( 7270b57cec5SDimitry Andric __h, _VSTD::move(__nh)); 7280b57cec5SDimitry Andric } 7290b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7300b57cec5SDimitry Andric node_type extract(key_type const& __key) 7310b57cec5SDimitry Andric { 7320b57cec5SDimitry Andric return __table_.template __node_handle_extract<node_type>(__key); 7330b57cec5SDimitry Andric } 7340b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7350b57cec5SDimitry Andric node_type extract(const_iterator __it) 7360b57cec5SDimitry Andric { 7370b57cec5SDimitry Andric return __table_.template __node_handle_extract<node_type>(__it); 7380b57cec5SDimitry Andric } 7390b57cec5SDimitry Andric 7400b57cec5SDimitry Andric template<class _H2, class _P2> 7410b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7420b57cec5SDimitry Andric void merge(unordered_set<key_type, _H2, _P2, allocator_type>& __source) 7430b57cec5SDimitry Andric { 7440b57cec5SDimitry Andric _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 7450b57cec5SDimitry Andric "merging container with incompatible allocator"); 7460b57cec5SDimitry Andric __table_.__node_handle_merge_unique(__source.__table_); 7470b57cec5SDimitry Andric } 7480b57cec5SDimitry Andric template<class _H2, class _P2> 7490b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7500b57cec5SDimitry Andric void merge(unordered_set<key_type, _H2, _P2, allocator_type>&& __source) 7510b57cec5SDimitry Andric { 7520b57cec5SDimitry Andric _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 7530b57cec5SDimitry Andric "merging container with incompatible allocator"); 7540b57cec5SDimitry Andric __table_.__node_handle_merge_unique(__source.__table_); 7550b57cec5SDimitry Andric } 7560b57cec5SDimitry Andric template<class _H2, class _P2> 7570b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7580b57cec5SDimitry Andric void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>& __source) 7590b57cec5SDimitry Andric { 7600b57cec5SDimitry Andric _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 7610b57cec5SDimitry Andric "merging container with incompatible allocator"); 7620b57cec5SDimitry Andric __table_.__node_handle_merge_unique(__source.__table_); 7630b57cec5SDimitry Andric } 7640b57cec5SDimitry Andric template<class _H2, class _P2> 7650b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7660b57cec5SDimitry Andric void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>&& __source) 7670b57cec5SDimitry Andric { 7680b57cec5SDimitry Andric _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 7690b57cec5SDimitry Andric "merging container with incompatible allocator"); 7700b57cec5SDimitry Andric __table_.__node_handle_merge_unique(__source.__table_); 7710b57cec5SDimitry Andric } 7720b57cec5SDimitry Andric#endif 7730b57cec5SDimitry Andric 7740b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7750b57cec5SDimitry Andric void swap(unordered_set& __u) 7760b57cec5SDimitry Andric _NOEXCEPT_(__is_nothrow_swappable<__table>::value) 7770b57cec5SDimitry Andric {__table_.swap(__u.__table_);} 7780b57cec5SDimitry Andric 7790b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7800b57cec5SDimitry Andric hasher hash_function() const {return __table_.hash_function();} 7810b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7820b57cec5SDimitry Andric key_equal key_eq() const {return __table_.key_eq();} 7830b57cec5SDimitry Andric 7840b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7850b57cec5SDimitry Andric iterator find(const key_type& __k) {return __table_.find(__k);} 7860b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7870b57cec5SDimitry Andric const_iterator find(const key_type& __k) const {return __table_.find(__k);} 788e8d8bef9SDimitry Andric#if _LIBCPP_STD_VER > 17 789349cc55cSDimitry Andric template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 790e8d8bef9SDimitry Andric _LIBCPP_INLINE_VISIBILITY 791349cc55cSDimitry Andric iterator find(const _K2& __k) {return __table_.find(__k);} 792349cc55cSDimitry Andric template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 793e8d8bef9SDimitry Andric _LIBCPP_INLINE_VISIBILITY 794349cc55cSDimitry Andric const_iterator find(const _K2& __k) const {return __table_.find(__k);} 795e8d8bef9SDimitry Andric#endif // _LIBCPP_STD_VER > 17 796349cc55cSDimitry Andric 7970b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7980b57cec5SDimitry Andric size_type count(const key_type& __k) const {return __table_.__count_unique(__k);} 7990b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 17 800349cc55cSDimitry Andric template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 801e8d8bef9SDimitry Andric _LIBCPP_INLINE_VISIBILITY 802349cc55cSDimitry Andric size_type count(const _K2& __k) const {return __table_.__count_unique(__k);} 803e8d8bef9SDimitry Andric#endif // _LIBCPP_STD_VER > 17 804349cc55cSDimitry Andric 805e8d8bef9SDimitry Andric#if _LIBCPP_STD_VER > 17 8060b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8070b57cec5SDimitry Andric bool contains(const key_type& __k) const {return find(__k) != end();} 808e8d8bef9SDimitry Andric 809349cc55cSDimitry Andric template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 810e8d8bef9SDimitry Andric _LIBCPP_INLINE_VISIBILITY 811349cc55cSDimitry Andric bool contains(const _K2& __k) const {return find(__k) != end();} 8120b57cec5SDimitry Andric#endif // _LIBCPP_STD_VER > 17 813349cc55cSDimitry Andric 8140b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8150b57cec5SDimitry Andric pair<iterator, iterator> equal_range(const key_type& __k) 8160b57cec5SDimitry Andric {return __table_.__equal_range_unique(__k);} 8170b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8180b57cec5SDimitry Andric pair<const_iterator, const_iterator> equal_range(const key_type& __k) const 8190b57cec5SDimitry Andric {return __table_.__equal_range_unique(__k);} 820e8d8bef9SDimitry Andric#if _LIBCPP_STD_VER > 17 821349cc55cSDimitry Andric template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 822e8d8bef9SDimitry Andric _LIBCPP_INLINE_VISIBILITY 823349cc55cSDimitry Andric pair<iterator, iterator> equal_range(const _K2& __k) 824349cc55cSDimitry Andric {return __table_.__equal_range_unique(__k);} 825349cc55cSDimitry Andric template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 826e8d8bef9SDimitry Andric _LIBCPP_INLINE_VISIBILITY 827349cc55cSDimitry Andric pair<const_iterator, const_iterator> equal_range(const _K2& __k) const 828349cc55cSDimitry Andric {return __table_.__equal_range_unique(__k);} 829e8d8bef9SDimitry Andric#endif // _LIBCPP_STD_VER > 17 8300b57cec5SDimitry Andric 8310b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8320b57cec5SDimitry Andric size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();} 8330b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8340b57cec5SDimitry Andric size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();} 8350b57cec5SDimitry Andric 8360b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8370b57cec5SDimitry Andric size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);} 8380b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8390b57cec5SDimitry Andric size_type bucket(const key_type& __k) const {return __table_.bucket(__k);} 8400b57cec5SDimitry Andric 8410b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8420b57cec5SDimitry Andric local_iterator begin(size_type __n) {return __table_.begin(__n);} 8430b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8440b57cec5SDimitry Andric local_iterator end(size_type __n) {return __table_.end(__n);} 8450b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8460b57cec5SDimitry Andric const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);} 8470b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8480b57cec5SDimitry Andric const_local_iterator end(size_type __n) const {return __table_.cend(__n);} 8490b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8500b57cec5SDimitry Andric const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);} 8510b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8520b57cec5SDimitry Andric const_local_iterator cend(size_type __n) const {return __table_.cend(__n);} 8530b57cec5SDimitry Andric 8540b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8550b57cec5SDimitry Andric float load_factor() const _NOEXCEPT {return __table_.load_factor();} 8560b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8570b57cec5SDimitry Andric float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();} 8580b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8590b57cec5SDimitry Andric void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);} 8600b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8610b57cec5SDimitry Andric void rehash(size_type __n) {__table_.rehash(__n);} 8620b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 8630b57cec5SDimitry Andric void reserve(size_type __n) {__table_.reserve(__n);} 8640b57cec5SDimitry Andric 865*81ad6265SDimitry Andric#ifdef _LIBCPP_ENABLE_DEBUG_MODE 8660b57cec5SDimitry Andric 8670b57cec5SDimitry Andric bool __dereferenceable(const const_iterator* __i) const 8680b57cec5SDimitry Andric {return __table_.__dereferenceable(__i);} 8690b57cec5SDimitry Andric bool __decrementable(const const_iterator* __i) const 8700b57cec5SDimitry Andric {return __table_.__decrementable(__i);} 8710b57cec5SDimitry Andric bool __addable(const const_iterator* __i, ptrdiff_t __n) const 8720b57cec5SDimitry Andric {return __table_.__addable(__i, __n);} 8730b57cec5SDimitry Andric bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const 8740b57cec5SDimitry Andric {return __table_.__addable(__i, __n);} 8750b57cec5SDimitry Andric 876*81ad6265SDimitry Andric#endif // _LIBCPP_ENABLE_DEBUG_MODE 8770b57cec5SDimitry Andric 8780b57cec5SDimitry Andric}; 8790b57cec5SDimitry Andric 880349cc55cSDimitry Andric#if _LIBCPP_STD_VER >= 17 8810b57cec5SDimitry Andrictemplate<class _InputIterator, 8820b57cec5SDimitry Andric class _Hash = hash<__iter_value_type<_InputIterator>>, 8830b57cec5SDimitry Andric class _Pred = equal_to<__iter_value_type<_InputIterator>>, 8840b57cec5SDimitry Andric class _Allocator = allocator<__iter_value_type<_InputIterator>>, 885349cc55cSDimitry Andric class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, 886349cc55cSDimitry Andric class = enable_if_t<!__is_allocator<_Hash>::value>, 887349cc55cSDimitry Andric class = enable_if_t<!is_integral<_Hash>::value>, 888349cc55cSDimitry Andric class = enable_if_t<!__is_allocator<_Pred>::value>, 889349cc55cSDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value>> 8900b57cec5SDimitry Andricunordered_set(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0, 8910b57cec5SDimitry Andric _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) 8920b57cec5SDimitry Andric -> unordered_set<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>; 8930b57cec5SDimitry Andric 8940b57cec5SDimitry Andrictemplate<class _Tp, class _Hash = hash<_Tp>, 8950b57cec5SDimitry Andric class _Pred = equal_to<_Tp>, 8960b57cec5SDimitry Andric class _Allocator = allocator<_Tp>, 897349cc55cSDimitry Andric class = enable_if_t<!__is_allocator<_Hash>::value>, 898349cc55cSDimitry Andric class = enable_if_t<!is_integral<_Hash>::value>, 899349cc55cSDimitry Andric class = enable_if_t<!__is_allocator<_Pred>::value>, 900349cc55cSDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value>> 9010b57cec5SDimitry Andricunordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type = 0, 9020b57cec5SDimitry Andric _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) 9030b57cec5SDimitry Andric -> unordered_set<_Tp, _Hash, _Pred, _Allocator>; 9040b57cec5SDimitry Andric 9050b57cec5SDimitry Andrictemplate<class _InputIterator, class _Allocator, 906349cc55cSDimitry Andric class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, 907349cc55cSDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value>> 9080b57cec5SDimitry Andricunordered_set(_InputIterator, _InputIterator, 9090b57cec5SDimitry Andric typename allocator_traits<_Allocator>::size_type, _Allocator) 9100b57cec5SDimitry Andric -> unordered_set<__iter_value_type<_InputIterator>, 9110b57cec5SDimitry Andric hash<__iter_value_type<_InputIterator>>, 9120b57cec5SDimitry Andric equal_to<__iter_value_type<_InputIterator>>, 9130b57cec5SDimitry Andric _Allocator>; 9140b57cec5SDimitry Andric 9150b57cec5SDimitry Andrictemplate<class _InputIterator, class _Hash, class _Allocator, 916349cc55cSDimitry Andric class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, 917349cc55cSDimitry Andric class = enable_if_t<!__is_allocator<_Hash>::value>, 918349cc55cSDimitry Andric class = enable_if_t<!is_integral<_Hash>::value>, 919349cc55cSDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value>> 9200b57cec5SDimitry Andricunordered_set(_InputIterator, _InputIterator, 9210b57cec5SDimitry Andric typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator) 9220b57cec5SDimitry Andric -> unordered_set<__iter_value_type<_InputIterator>, _Hash, 9230b57cec5SDimitry Andric equal_to<__iter_value_type<_InputIterator>>, 9240b57cec5SDimitry Andric _Allocator>; 9250b57cec5SDimitry Andric 9260b57cec5SDimitry Andrictemplate<class _Tp, class _Allocator, 927349cc55cSDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value>> 9280b57cec5SDimitry Andricunordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Allocator) 9290b57cec5SDimitry Andric -> unordered_set<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>; 9300b57cec5SDimitry Andric 9310b57cec5SDimitry Andrictemplate<class _Tp, class _Hash, class _Allocator, 932349cc55cSDimitry Andric class = enable_if_t<!__is_allocator<_Hash>::value>, 933349cc55cSDimitry Andric class = enable_if_t<!is_integral<_Hash>::value>, 934349cc55cSDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value>> 9350b57cec5SDimitry Andricunordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator) 9360b57cec5SDimitry Andric -> unordered_set<_Tp, _Hash, equal_to<_Tp>, _Allocator>; 9370b57cec5SDimitry Andric#endif 9380b57cec5SDimitry Andric 9390b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 9400b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n, 9410b57cec5SDimitry Andric const hasher& __hf, const key_equal& __eql) 9420b57cec5SDimitry Andric : __table_(__hf, __eql) 9430b57cec5SDimitry Andric{ 94404eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 9450b57cec5SDimitry Andric __table_.rehash(__n); 9460b57cec5SDimitry Andric} 9470b57cec5SDimitry Andric 9480b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 9490b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n, 9500b57cec5SDimitry Andric const hasher& __hf, const key_equal& __eql, const allocator_type& __a) 9510b57cec5SDimitry Andric : __table_(__hf, __eql, __a) 9520b57cec5SDimitry Andric{ 95304eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 9540b57cec5SDimitry Andric __table_.rehash(__n); 9550b57cec5SDimitry Andric} 9560b57cec5SDimitry Andric 9570b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 9580b57cec5SDimitry Andrictemplate <class _InputIterator> 9590b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 9600b57cec5SDimitry Andric _InputIterator __first, _InputIterator __last) 9610b57cec5SDimitry Andric{ 96204eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 9630b57cec5SDimitry Andric insert(__first, __last); 9640b57cec5SDimitry Andric} 9650b57cec5SDimitry Andric 9660b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 9670b57cec5SDimitry Andrictemplate <class _InputIterator> 9680b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 9690b57cec5SDimitry Andric _InputIterator __first, _InputIterator __last, size_type __n, 9700b57cec5SDimitry Andric const hasher& __hf, const key_equal& __eql) 9710b57cec5SDimitry Andric : __table_(__hf, __eql) 9720b57cec5SDimitry Andric{ 97304eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 9740b57cec5SDimitry Andric __table_.rehash(__n); 9750b57cec5SDimitry Andric insert(__first, __last); 9760b57cec5SDimitry Andric} 9770b57cec5SDimitry Andric 9780b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 9790b57cec5SDimitry Andrictemplate <class _InputIterator> 9800b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 9810b57cec5SDimitry Andric _InputIterator __first, _InputIterator __last, size_type __n, 9820b57cec5SDimitry Andric const hasher& __hf, const key_equal& __eql, const allocator_type& __a) 9830b57cec5SDimitry Andric : __table_(__hf, __eql, __a) 9840b57cec5SDimitry Andric{ 98504eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 9860b57cec5SDimitry Andric __table_.rehash(__n); 9870b57cec5SDimitry Andric insert(__first, __last); 9880b57cec5SDimitry Andric} 9890b57cec5SDimitry Andric 9900b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 9910b57cec5SDimitry Andricinline 9920b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 9930b57cec5SDimitry Andric const allocator_type& __a) 9940b57cec5SDimitry Andric : __table_(__a) 9950b57cec5SDimitry Andric{ 99604eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 9970b57cec5SDimitry Andric} 9980b57cec5SDimitry Andric 9990b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 10000b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 10010b57cec5SDimitry Andric const unordered_set& __u) 10020b57cec5SDimitry Andric : __table_(__u.__table_) 10030b57cec5SDimitry Andric{ 100404eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 10050b57cec5SDimitry Andric __table_.rehash(__u.bucket_count()); 10060b57cec5SDimitry Andric insert(__u.begin(), __u.end()); 10070b57cec5SDimitry Andric} 10080b57cec5SDimitry Andric 10090b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 10100b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 10110b57cec5SDimitry Andric const unordered_set& __u, const allocator_type& __a) 10120b57cec5SDimitry Andric : __table_(__u.__table_, __a) 10130b57cec5SDimitry Andric{ 101404eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 10150b57cec5SDimitry Andric __table_.rehash(__u.bucket_count()); 10160b57cec5SDimitry Andric insert(__u.begin(), __u.end()); 10170b57cec5SDimitry Andric} 10180b57cec5SDimitry Andric 10190b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG 10200b57cec5SDimitry Andric 10210b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 10220b57cec5SDimitry Andricinline 10230b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 10240b57cec5SDimitry Andric unordered_set&& __u) 10250b57cec5SDimitry Andric _NOEXCEPT_(is_nothrow_move_constructible<__table>::value) 10260b57cec5SDimitry Andric : __table_(_VSTD::move(__u.__table_)) 10270b57cec5SDimitry Andric{ 102804eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 1029*81ad6265SDimitry Andric std::__debug_db_swap(this, std::addressof(__u)); 10300b57cec5SDimitry Andric} 10310b57cec5SDimitry Andric 10320b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 10330b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 10340b57cec5SDimitry Andric unordered_set&& __u, const allocator_type& __a) 10350b57cec5SDimitry Andric : __table_(_VSTD::move(__u.__table_), __a) 10360b57cec5SDimitry Andric{ 103704eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 10380b57cec5SDimitry Andric if (__a != __u.get_allocator()) 10390b57cec5SDimitry Andric { 10400b57cec5SDimitry Andric iterator __i = __u.begin(); 10410b57cec5SDimitry Andric while (__u.size() != 0) 10420b57cec5SDimitry Andric __table_.__insert_unique(_VSTD::move(__u.__table_.remove(__i++)->__value_)); 10430b57cec5SDimitry Andric } 10440b57cec5SDimitry Andric else 1045*81ad6265SDimitry Andric std::__debug_db_swap(this, std::addressof(__u)); 10460b57cec5SDimitry Andric} 10470b57cec5SDimitry Andric 10480b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 10490b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 10500b57cec5SDimitry Andric initializer_list<value_type> __il) 10510b57cec5SDimitry Andric{ 105204eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 10530b57cec5SDimitry Andric insert(__il.begin(), __il.end()); 10540b57cec5SDimitry Andric} 10550b57cec5SDimitry Andric 10560b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 10570b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 10580b57cec5SDimitry Andric initializer_list<value_type> __il, size_type __n, const hasher& __hf, 10590b57cec5SDimitry Andric const key_equal& __eql) 10600b57cec5SDimitry Andric : __table_(__hf, __eql) 10610b57cec5SDimitry Andric{ 106204eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 10630b57cec5SDimitry Andric __table_.rehash(__n); 10640b57cec5SDimitry Andric insert(__il.begin(), __il.end()); 10650b57cec5SDimitry Andric} 10660b57cec5SDimitry Andric 10670b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 10680b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 10690b57cec5SDimitry Andric initializer_list<value_type> __il, size_type __n, const hasher& __hf, 10700b57cec5SDimitry Andric const key_equal& __eql, const allocator_type& __a) 10710b57cec5SDimitry Andric : __table_(__hf, __eql, __a) 10720b57cec5SDimitry Andric{ 107304eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 10740b57cec5SDimitry Andric __table_.rehash(__n); 10750b57cec5SDimitry Andric insert(__il.begin(), __il.end()); 10760b57cec5SDimitry Andric} 10770b57cec5SDimitry Andric 10780b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 10790b57cec5SDimitry Andricinline 10800b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>& 10810b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(unordered_set&& __u) 10820b57cec5SDimitry Andric _NOEXCEPT_(is_nothrow_move_assignable<__table>::value) 10830b57cec5SDimitry Andric{ 10840b57cec5SDimitry Andric __table_ = _VSTD::move(__u.__table_); 10850b57cec5SDimitry Andric return *this; 10860b57cec5SDimitry Andric} 10870b57cec5SDimitry Andric 10880b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 10890b57cec5SDimitry Andricinline 10900b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>& 10910b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::operator=( 10920b57cec5SDimitry Andric initializer_list<value_type> __il) 10930b57cec5SDimitry Andric{ 10940b57cec5SDimitry Andric __table_.__assign_unique(__il.begin(), __il.end()); 10950b57cec5SDimitry Andric return *this; 10960b57cec5SDimitry Andric} 10970b57cec5SDimitry Andric 10980b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG 10990b57cec5SDimitry Andric 11000b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 11010b57cec5SDimitry Andrictemplate <class _InputIterator> 11020b57cec5SDimitry Andricinline 11030b57cec5SDimitry Andricvoid 11040b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, 11050b57cec5SDimitry Andric _InputIterator __last) 11060b57cec5SDimitry Andric{ 11070b57cec5SDimitry Andric for (; __first != __last; ++__first) 11080b57cec5SDimitry Andric __table_.__insert_unique(*__first); 11090b57cec5SDimitry Andric} 11100b57cec5SDimitry Andric 11110b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 11120b57cec5SDimitry Andricinline _LIBCPP_INLINE_VISIBILITY 11130b57cec5SDimitry Andricvoid 11140b57cec5SDimitry Andricswap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, 11150b57cec5SDimitry Andric unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) 11160b57cec5SDimitry Andric _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) 11170b57cec5SDimitry Andric{ 11180b57cec5SDimitry Andric __x.swap(__y); 11190b57cec5SDimitry Andric} 11200b57cec5SDimitry Andric 11210b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 17 11225ffd83dbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc, 11235ffd83dbSDimitry Andric class _Predicate> 11240b57cec5SDimitry Andricinline _LIBCPP_INLINE_VISIBILITY 11255ffd83dbSDimitry Andric typename unordered_set<_Value, _Hash, _Pred, _Alloc>::size_type 11265ffd83dbSDimitry Andric erase_if(unordered_set<_Value, _Hash, _Pred, _Alloc>& __c, 11275ffd83dbSDimitry Andric _Predicate __pred) { 1128fe6060f1SDimitry Andric return _VSTD::__libcpp_erase_if_container(__c, __pred); 11295ffd83dbSDimitry Andric} 11300b57cec5SDimitry Andric#endif 11310b57cec5SDimitry Andric 11320b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 11330b57cec5SDimitry Andricbool 11340b57cec5SDimitry Andricoperator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, 11350b57cec5SDimitry Andric const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) 11360b57cec5SDimitry Andric{ 11370b57cec5SDimitry Andric if (__x.size() != __y.size()) 11380b57cec5SDimitry Andric return false; 11390b57cec5SDimitry Andric typedef typename unordered_set<_Value, _Hash, _Pred, _Alloc>::const_iterator 11400b57cec5SDimitry Andric const_iterator; 11410b57cec5SDimitry Andric for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end(); 11420b57cec5SDimitry Andric __i != __ex; ++__i) 11430b57cec5SDimitry Andric { 11440b57cec5SDimitry Andric const_iterator __j = __y.find(*__i); 11450b57cec5SDimitry Andric if (__j == __ey || !(*__i == *__j)) 11460b57cec5SDimitry Andric return false; 11470b57cec5SDimitry Andric } 11480b57cec5SDimitry Andric return true; 11490b57cec5SDimitry Andric} 11500b57cec5SDimitry Andric 11510b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 11520b57cec5SDimitry Andricinline _LIBCPP_INLINE_VISIBILITY 11530b57cec5SDimitry Andricbool 11540b57cec5SDimitry Andricoperator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, 11550b57cec5SDimitry Andric const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) 11560b57cec5SDimitry Andric{ 11570b57cec5SDimitry Andric return !(__x == __y); 11580b57cec5SDimitry Andric} 11590b57cec5SDimitry Andric 11600b57cec5SDimitry Andrictemplate <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>, 11610b57cec5SDimitry Andric class _Alloc = allocator<_Value> > 11620b57cec5SDimitry Andricclass _LIBCPP_TEMPLATE_VIS unordered_multiset 11630b57cec5SDimitry Andric{ 11640b57cec5SDimitry Andricpublic: 11650b57cec5SDimitry Andric // types 11660b57cec5SDimitry Andric typedef _Value key_type; 11670b57cec5SDimitry Andric typedef key_type value_type; 1168*81ad6265SDimitry Andric typedef __type_identity_t<_Hash> hasher; 1169*81ad6265SDimitry Andric typedef __type_identity_t<_Pred> key_equal; 1170*81ad6265SDimitry Andric typedef __type_identity_t<_Alloc> allocator_type; 11710b57cec5SDimitry Andric typedef value_type& reference; 11720b57cec5SDimitry Andric typedef const value_type& const_reference; 11730b57cec5SDimitry Andric static_assert((is_same<value_type, typename allocator_type::value_type>::value), 11740b57cec5SDimitry Andric "Invalid allocator::value_type"); 11750b57cec5SDimitry Andric 11760b57cec5SDimitry Andricprivate: 11770b57cec5SDimitry Andric typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table; 11780b57cec5SDimitry Andric 11790b57cec5SDimitry Andric __table __table_; 11800b57cec5SDimitry Andric 11810b57cec5SDimitry Andricpublic: 11820b57cec5SDimitry Andric typedef typename __table::pointer pointer; 11830b57cec5SDimitry Andric typedef typename __table::const_pointer const_pointer; 11840b57cec5SDimitry Andric typedef typename __table::size_type size_type; 11850b57cec5SDimitry Andric typedef typename __table::difference_type difference_type; 11860b57cec5SDimitry Andric 11870b57cec5SDimitry Andric typedef typename __table::const_iterator iterator; 11880b57cec5SDimitry Andric typedef typename __table::const_iterator const_iterator; 11890b57cec5SDimitry Andric typedef typename __table::const_local_iterator local_iterator; 11900b57cec5SDimitry Andric typedef typename __table::const_local_iterator const_local_iterator; 11910b57cec5SDimitry Andric 11920b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 14 11930b57cec5SDimitry Andric typedef __set_node_handle<typename __table::__node, allocator_type> node_type; 11940b57cec5SDimitry Andric#endif 11950b57cec5SDimitry Andric 11960b57cec5SDimitry Andric template <class _Value2, class _Hash2, class _Pred2, class _Alloc2> 11970b57cec5SDimitry Andric friend class _LIBCPP_TEMPLATE_VIS unordered_set; 11980b57cec5SDimitry Andric template <class _Value2, class _Hash2, class _Pred2, class _Alloc2> 11990b57cec5SDimitry Andric friend class _LIBCPP_TEMPLATE_VIS unordered_multiset; 12000b57cec5SDimitry Andric 12010b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 12020b57cec5SDimitry Andric unordered_multiset() 12030b57cec5SDimitry Andric _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) 12040b57cec5SDimitry Andric { 120504eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 12060b57cec5SDimitry Andric } 12070b57cec5SDimitry Andric explicit unordered_multiset(size_type __n, const hasher& __hf = hasher(), 12080b57cec5SDimitry Andric const key_equal& __eql = key_equal()); 12090b57cec5SDimitry Andric unordered_multiset(size_type __n, const hasher& __hf, 12100b57cec5SDimitry Andric const key_equal& __eql, const allocator_type& __a); 12110b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 11 12120b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 12130b57cec5SDimitry Andric unordered_multiset(size_type __n, const allocator_type& __a) 12140b57cec5SDimitry Andric : unordered_multiset(__n, hasher(), key_equal(), __a) {} 12150b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 12160b57cec5SDimitry Andric unordered_multiset(size_type __n, const hasher& __hf, const allocator_type& __a) 12170b57cec5SDimitry Andric : unordered_multiset(__n, __hf, key_equal(), __a) {} 12180b57cec5SDimitry Andric#endif 12190b57cec5SDimitry Andric template <class _InputIterator> 12200b57cec5SDimitry Andric unordered_multiset(_InputIterator __first, _InputIterator __last); 12210b57cec5SDimitry Andric template <class _InputIterator> 12220b57cec5SDimitry Andric unordered_multiset(_InputIterator __first, _InputIterator __last, 12230b57cec5SDimitry Andric size_type __n, const hasher& __hf = hasher(), 12240b57cec5SDimitry Andric const key_equal& __eql = key_equal()); 12250b57cec5SDimitry Andric template <class _InputIterator> 12260b57cec5SDimitry Andric unordered_multiset(_InputIterator __first, _InputIterator __last, 12270b57cec5SDimitry Andric size_type __n , const hasher& __hf, 12280b57cec5SDimitry Andric const key_equal& __eql, const allocator_type& __a); 12290b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 11 12300b57cec5SDimitry Andric template <class _InputIterator> 12310b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 12320b57cec5SDimitry Andric unordered_multiset(_InputIterator __first, _InputIterator __last, 12330b57cec5SDimitry Andric size_type __n, const allocator_type& __a) 12340b57cec5SDimitry Andric : unordered_multiset(__first, __last, __n, hasher(), key_equal(), __a) {} 12350b57cec5SDimitry Andric template <class _InputIterator> 12360b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 12370b57cec5SDimitry Andric unordered_multiset(_InputIterator __first, _InputIterator __last, 12380b57cec5SDimitry Andric size_type __n, const hasher& __hf, const allocator_type& __a) 12390b57cec5SDimitry Andric : unordered_multiset(__first, __last, __n, __hf, key_equal(), __a) {} 12400b57cec5SDimitry Andric#endif 12410b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 12420b57cec5SDimitry Andric explicit unordered_multiset(const allocator_type& __a); 12430b57cec5SDimitry Andric unordered_multiset(const unordered_multiset& __u); 12440b57cec5SDimitry Andric unordered_multiset(const unordered_multiset& __u, const allocator_type& __a); 12450b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG 12460b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 12470b57cec5SDimitry Andric unordered_multiset(unordered_multiset&& __u) 12480b57cec5SDimitry Andric _NOEXCEPT_(is_nothrow_move_constructible<__table>::value); 12490b57cec5SDimitry Andric unordered_multiset(unordered_multiset&& __u, const allocator_type& __a); 12500b57cec5SDimitry Andric unordered_multiset(initializer_list<value_type> __il); 12510b57cec5SDimitry Andric unordered_multiset(initializer_list<value_type> __il, size_type __n, 12520b57cec5SDimitry Andric const hasher& __hf = hasher(), 12530b57cec5SDimitry Andric const key_equal& __eql = key_equal()); 12540b57cec5SDimitry Andric unordered_multiset(initializer_list<value_type> __il, size_type __n, 12550b57cec5SDimitry Andric const hasher& __hf, const key_equal& __eql, 12560b57cec5SDimitry Andric const allocator_type& __a); 12570b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 11 12580b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 12590b57cec5SDimitry Andric unordered_multiset(initializer_list<value_type> __il, size_type __n, const allocator_type& __a) 12600b57cec5SDimitry Andric : unordered_multiset(__il, __n, hasher(), key_equal(), __a) {} 12610b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 12620b57cec5SDimitry Andric unordered_multiset(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a) 12630b57cec5SDimitry Andric : unordered_multiset(__il, __n, __hf, key_equal(), __a) {} 12640b57cec5SDimitry Andric#endif 12650b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG 12660b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 12670b57cec5SDimitry Andric ~unordered_multiset() { 12680b57cec5SDimitry Andric static_assert(sizeof(__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), ""); 12690b57cec5SDimitry Andric } 12700b57cec5SDimitry Andric 12710b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 12720b57cec5SDimitry Andric unordered_multiset& operator=(const unordered_multiset& __u) 12730b57cec5SDimitry Andric { 12740b57cec5SDimitry Andric __table_ = __u.__table_; 12750b57cec5SDimitry Andric return *this; 12760b57cec5SDimitry Andric } 12770b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG 12780b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 12790b57cec5SDimitry Andric unordered_multiset& operator=(unordered_multiset&& __u) 12800b57cec5SDimitry Andric _NOEXCEPT_(is_nothrow_move_assignable<__table>::value); 12810b57cec5SDimitry Andric unordered_multiset& operator=(initializer_list<value_type> __il); 12820b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG 12830b57cec5SDimitry Andric 12840b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 12850b57cec5SDimitry Andric allocator_type get_allocator() const _NOEXCEPT 12860b57cec5SDimitry Andric {return allocator_type(__table_.__node_alloc());} 12870b57cec5SDimitry Andric 12880b57cec5SDimitry Andric _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY 12890b57cec5SDimitry Andric bool empty() const _NOEXCEPT {return __table_.size() == 0;} 12900b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 12910b57cec5SDimitry Andric size_type size() const _NOEXCEPT {return __table_.size();} 12920b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 12930b57cec5SDimitry Andric size_type max_size() const _NOEXCEPT {return __table_.max_size();} 12940b57cec5SDimitry Andric 12950b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 12960b57cec5SDimitry Andric iterator begin() _NOEXCEPT {return __table_.begin();} 12970b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 12980b57cec5SDimitry Andric iterator end() _NOEXCEPT {return __table_.end();} 12990b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13000b57cec5SDimitry Andric const_iterator begin() const _NOEXCEPT {return __table_.begin();} 13010b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13020b57cec5SDimitry Andric const_iterator end() const _NOEXCEPT {return __table_.end();} 13030b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13040b57cec5SDimitry Andric const_iterator cbegin() const _NOEXCEPT {return __table_.begin();} 13050b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13060b57cec5SDimitry Andric const_iterator cend() const _NOEXCEPT {return __table_.end();} 13070b57cec5SDimitry Andric 13080b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG 13090b57cec5SDimitry Andric template <class... _Args> 13100b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13110b57cec5SDimitry Andric iterator emplace(_Args&&... __args) 13120b57cec5SDimitry Andric {return __table_.__emplace_multi(_VSTD::forward<_Args>(__args)...);} 13130b57cec5SDimitry Andric template <class... _Args> 13140b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13150b57cec5SDimitry Andric iterator emplace_hint(const_iterator __p, _Args&&... __args) 13160b57cec5SDimitry Andric {return __table_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);} 13170b57cec5SDimitry Andric 13180b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13190b57cec5SDimitry Andric iterator insert(value_type&& __x) {return __table_.__insert_multi(_VSTD::move(__x));} 13200b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13210b57cec5SDimitry Andric iterator insert(const_iterator __p, value_type&& __x) 13220b57cec5SDimitry Andric {return __table_.__insert_multi(__p, _VSTD::move(__x));} 13230b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13240b57cec5SDimitry Andric void insert(initializer_list<value_type> __il) 13250b57cec5SDimitry Andric {insert(__il.begin(), __il.end());} 13260b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG 13270b57cec5SDimitry Andric 13280b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13290b57cec5SDimitry Andric iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);} 13300b57cec5SDimitry Andric 13310b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13320b57cec5SDimitry Andric iterator insert(const_iterator __p, const value_type& __x) 13330b57cec5SDimitry Andric {return __table_.__insert_multi(__p, __x);} 13340b57cec5SDimitry Andric 13350b57cec5SDimitry Andric template <class _InputIterator> 13360b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13370b57cec5SDimitry Andric void insert(_InputIterator __first, _InputIterator __last); 13380b57cec5SDimitry Andric 13390b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 14 13400b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13410b57cec5SDimitry Andric iterator insert(node_type&& __nh) 13420b57cec5SDimitry Andric { 13430b57cec5SDimitry Andric _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), 13440b57cec5SDimitry Andric "node_type with incompatible allocator passed to unordered_multiset::insert()"); 13450b57cec5SDimitry Andric return __table_.template __node_handle_insert_multi<node_type>( 13460b57cec5SDimitry Andric _VSTD::move(__nh)); 13470b57cec5SDimitry Andric } 13480b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13490b57cec5SDimitry Andric iterator insert(const_iterator __hint, node_type&& __nh) 13500b57cec5SDimitry Andric { 13510b57cec5SDimitry Andric _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), 13520b57cec5SDimitry Andric "node_type with incompatible allocator passed to unordered_multiset::insert()"); 13530b57cec5SDimitry Andric return __table_.template __node_handle_insert_multi<node_type>( 13540b57cec5SDimitry Andric __hint, _VSTD::move(__nh)); 13550b57cec5SDimitry Andric } 13560b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13570b57cec5SDimitry Andric node_type extract(const_iterator __position) 13580b57cec5SDimitry Andric { 13590b57cec5SDimitry Andric return __table_.template __node_handle_extract<node_type>( 13600b57cec5SDimitry Andric __position); 13610b57cec5SDimitry Andric } 13620b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13630b57cec5SDimitry Andric node_type extract(key_type const& __key) 13640b57cec5SDimitry Andric { 13650b57cec5SDimitry Andric return __table_.template __node_handle_extract<node_type>(__key); 13660b57cec5SDimitry Andric } 13670b57cec5SDimitry Andric 13680b57cec5SDimitry Andric template <class _H2, class _P2> 13690b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13700b57cec5SDimitry Andric void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>& __source) 13710b57cec5SDimitry Andric { 13720b57cec5SDimitry Andric _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 13730b57cec5SDimitry Andric "merging container with incompatible allocator"); 13740b57cec5SDimitry Andric return __table_.__node_handle_merge_multi(__source.__table_); 13750b57cec5SDimitry Andric } 13760b57cec5SDimitry Andric template <class _H2, class _P2> 13770b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13780b57cec5SDimitry Andric void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>&& __source) 13790b57cec5SDimitry Andric { 13800b57cec5SDimitry Andric _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 13810b57cec5SDimitry Andric "merging container with incompatible allocator"); 13820b57cec5SDimitry Andric return __table_.__node_handle_merge_multi(__source.__table_); 13830b57cec5SDimitry Andric } 13840b57cec5SDimitry Andric template <class _H2, class _P2> 13850b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13860b57cec5SDimitry Andric void merge(unordered_set<key_type, _H2, _P2, allocator_type>& __source) 13870b57cec5SDimitry Andric { 13880b57cec5SDimitry Andric _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 13890b57cec5SDimitry Andric "merging container with incompatible allocator"); 13900b57cec5SDimitry Andric return __table_.__node_handle_merge_multi(__source.__table_); 13910b57cec5SDimitry Andric } 13920b57cec5SDimitry Andric template <class _H2, class _P2> 13930b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 13940b57cec5SDimitry Andric void merge(unordered_set<key_type, _H2, _P2, allocator_type>&& __source) 13950b57cec5SDimitry Andric { 13960b57cec5SDimitry Andric _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 13970b57cec5SDimitry Andric "merging container with incompatible allocator"); 13980b57cec5SDimitry Andric return __table_.__node_handle_merge_multi(__source.__table_); 13990b57cec5SDimitry Andric } 14000b57cec5SDimitry Andric#endif 14010b57cec5SDimitry Andric 14020b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14030b57cec5SDimitry Andric iterator erase(const_iterator __p) {return __table_.erase(__p);} 14040b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14050b57cec5SDimitry Andric size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);} 14060b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14070b57cec5SDimitry Andric iterator erase(const_iterator __first, const_iterator __last) 14080b57cec5SDimitry Andric {return __table_.erase(__first, __last);} 14090b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14100b57cec5SDimitry Andric void clear() _NOEXCEPT {__table_.clear();} 14110b57cec5SDimitry Andric 14120b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14130b57cec5SDimitry Andric void swap(unordered_multiset& __u) 14140b57cec5SDimitry Andric _NOEXCEPT_(__is_nothrow_swappable<__table>::value) 14150b57cec5SDimitry Andric {__table_.swap(__u.__table_);} 14160b57cec5SDimitry Andric 14170b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14180b57cec5SDimitry Andric hasher hash_function() const {return __table_.hash_function();} 14190b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14200b57cec5SDimitry Andric key_equal key_eq() const {return __table_.key_eq();} 14210b57cec5SDimitry Andric 14220b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14230b57cec5SDimitry Andric iterator find(const key_type& __k) {return __table_.find(__k);} 14240b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14250b57cec5SDimitry Andric const_iterator find(const key_type& __k) const {return __table_.find(__k);} 1426e8d8bef9SDimitry Andric#if _LIBCPP_STD_VER > 17 1427349cc55cSDimitry Andric template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 1428e8d8bef9SDimitry Andric _LIBCPP_INLINE_VISIBILITY 1429349cc55cSDimitry Andric iterator find(const _K2& __k) {return __table_.find(__k);} 1430349cc55cSDimitry Andric template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 1431e8d8bef9SDimitry Andric _LIBCPP_INLINE_VISIBILITY 1432349cc55cSDimitry Andric const_iterator find(const _K2& __k) const {return __table_.find(__k);} 1433e8d8bef9SDimitry Andric#endif // _LIBCPP_STD_VER > 17 1434349cc55cSDimitry Andric 14350b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14360b57cec5SDimitry Andric size_type count(const key_type& __k) const {return __table_.__count_multi(__k);} 14370b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 17 1438349cc55cSDimitry Andric template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 1439e8d8bef9SDimitry Andric _LIBCPP_INLINE_VISIBILITY 1440349cc55cSDimitry Andric size_type count(const _K2& __k) const {return __table_.__count_multi(__k);} 1441e8d8bef9SDimitry Andric#endif // _LIBCPP_STD_VER > 17 1442349cc55cSDimitry Andric 1443e8d8bef9SDimitry Andric#if _LIBCPP_STD_VER > 17 14440b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14450b57cec5SDimitry Andric bool contains(const key_type& __k) const {return find(__k) != end();} 1446e8d8bef9SDimitry Andric 1447349cc55cSDimitry Andric template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 1448e8d8bef9SDimitry Andric _LIBCPP_INLINE_VISIBILITY 1449349cc55cSDimitry Andric bool contains(const _K2& __k) const {return find(__k) != end();} 14500b57cec5SDimitry Andric#endif // _LIBCPP_STD_VER > 17 1451349cc55cSDimitry Andric 14520b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14530b57cec5SDimitry Andric pair<iterator, iterator> equal_range(const key_type& __k) 14540b57cec5SDimitry Andric {return __table_.__equal_range_multi(__k);} 14550b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14560b57cec5SDimitry Andric pair<const_iterator, const_iterator> equal_range(const key_type& __k) const 14570b57cec5SDimitry Andric {return __table_.__equal_range_multi(__k);} 1458e8d8bef9SDimitry Andric#if _LIBCPP_STD_VER > 17 1459349cc55cSDimitry Andric template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 1460e8d8bef9SDimitry Andric _LIBCPP_INLINE_VISIBILITY 1461349cc55cSDimitry Andric pair<iterator, iterator> equal_range(const _K2& __k) 1462349cc55cSDimitry Andric {return __table_.__equal_range_multi(__k);} 1463349cc55cSDimitry Andric template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 1464e8d8bef9SDimitry Andric _LIBCPP_INLINE_VISIBILITY 1465349cc55cSDimitry Andric pair<const_iterator, const_iterator> equal_range(const _K2& __k) const 1466349cc55cSDimitry Andric {return __table_.__equal_range_multi(__k);} 1467e8d8bef9SDimitry Andric#endif // _LIBCPP_STD_VER > 17 14680b57cec5SDimitry Andric 14690b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14700b57cec5SDimitry Andric size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();} 14710b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14720b57cec5SDimitry Andric size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();} 14730b57cec5SDimitry Andric 14740b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14750b57cec5SDimitry Andric size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);} 14760b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14770b57cec5SDimitry Andric size_type bucket(const key_type& __k) const {return __table_.bucket(__k);} 14780b57cec5SDimitry Andric 14790b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14800b57cec5SDimitry Andric local_iterator begin(size_type __n) {return __table_.begin(__n);} 14810b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14820b57cec5SDimitry Andric local_iterator end(size_type __n) {return __table_.end(__n);} 14830b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14840b57cec5SDimitry Andric const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);} 14850b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14860b57cec5SDimitry Andric const_local_iterator end(size_type __n) const {return __table_.cend(__n);} 14870b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14880b57cec5SDimitry Andric const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);} 14890b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14900b57cec5SDimitry Andric const_local_iterator cend(size_type __n) const {return __table_.cend(__n);} 14910b57cec5SDimitry Andric 14920b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14930b57cec5SDimitry Andric float load_factor() const _NOEXCEPT {return __table_.load_factor();} 14940b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14950b57cec5SDimitry Andric float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();} 14960b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14970b57cec5SDimitry Andric void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);} 14980b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 14990b57cec5SDimitry Andric void rehash(size_type __n) {__table_.rehash(__n);} 15000b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 15010b57cec5SDimitry Andric void reserve(size_type __n) {__table_.reserve(__n);} 15020b57cec5SDimitry Andric 1503*81ad6265SDimitry Andric#ifdef _LIBCPP_ENABLE_DEBUG_MODE 15040b57cec5SDimitry Andric 15050b57cec5SDimitry Andric bool __dereferenceable(const const_iterator* __i) const 15060b57cec5SDimitry Andric {return __table_.__dereferenceable(__i);} 15070b57cec5SDimitry Andric bool __decrementable(const const_iterator* __i) const 15080b57cec5SDimitry Andric {return __table_.__decrementable(__i);} 15090b57cec5SDimitry Andric bool __addable(const const_iterator* __i, ptrdiff_t __n) const 15100b57cec5SDimitry Andric {return __table_.__addable(__i, __n);} 15110b57cec5SDimitry Andric bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const 15120b57cec5SDimitry Andric {return __table_.__addable(__i, __n);} 15130b57cec5SDimitry Andric 1514*81ad6265SDimitry Andric#endif // _LIBCPP_ENABLE_DEBUG_MODE 15150b57cec5SDimitry Andric 15160b57cec5SDimitry Andric}; 15170b57cec5SDimitry Andric 1518349cc55cSDimitry Andric#if _LIBCPP_STD_VER >= 17 15190b57cec5SDimitry Andrictemplate<class _InputIterator, 15200b57cec5SDimitry Andric class _Hash = hash<__iter_value_type<_InputIterator>>, 15210b57cec5SDimitry Andric class _Pred = equal_to<__iter_value_type<_InputIterator>>, 15220b57cec5SDimitry Andric class _Allocator = allocator<__iter_value_type<_InputIterator>>, 1523349cc55cSDimitry Andric class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, 1524349cc55cSDimitry Andric class = enable_if_t<!__is_allocator<_Hash>::value>, 1525349cc55cSDimitry Andric class = enable_if_t<!is_integral<_Hash>::value>, 1526349cc55cSDimitry Andric class = enable_if_t<!__is_allocator<_Pred>::value>, 1527349cc55cSDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value>> 15280b57cec5SDimitry Andricunordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0, 15290b57cec5SDimitry Andric _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) 15300b57cec5SDimitry Andric -> unordered_multiset<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>; 15310b57cec5SDimitry Andric 15320b57cec5SDimitry Andrictemplate<class _Tp, class _Hash = hash<_Tp>, 15330b57cec5SDimitry Andric class _Pred = equal_to<_Tp>, class _Allocator = allocator<_Tp>, 1534349cc55cSDimitry Andric class = enable_if_t<!__is_allocator<_Hash>::value>, 1535349cc55cSDimitry Andric class = enable_if_t<!is_integral<_Hash>::value>, 1536349cc55cSDimitry Andric class = enable_if_t<!__is_allocator<_Pred>::value>, 1537349cc55cSDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value>> 15380b57cec5SDimitry Andricunordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type = 0, 15390b57cec5SDimitry Andric _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) 15400b57cec5SDimitry Andric -> unordered_multiset<_Tp, _Hash, _Pred, _Allocator>; 15410b57cec5SDimitry Andric 15420b57cec5SDimitry Andrictemplate<class _InputIterator, class _Allocator, 1543349cc55cSDimitry Andric class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, 1544349cc55cSDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value>> 15450b57cec5SDimitry Andricunordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator) 15460b57cec5SDimitry Andric -> unordered_multiset<__iter_value_type<_InputIterator>, 15470b57cec5SDimitry Andric hash<__iter_value_type<_InputIterator>>, 15480b57cec5SDimitry Andric equal_to<__iter_value_type<_InputIterator>>, 15490b57cec5SDimitry Andric _Allocator>; 15500b57cec5SDimitry Andric 15510b57cec5SDimitry Andrictemplate<class _InputIterator, class _Hash, class _Allocator, 1552349cc55cSDimitry Andric class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, 1553349cc55cSDimitry Andric class = enable_if_t<!__is_allocator<_Hash>::value>, 1554349cc55cSDimitry Andric class = enable_if_t<!is_integral<_Hash>::value>, 1555349cc55cSDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value>> 15560b57cec5SDimitry Andricunordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, 15570b57cec5SDimitry Andric _Hash, _Allocator) 15580b57cec5SDimitry Andric -> unordered_multiset<__iter_value_type<_InputIterator>, _Hash, 15590b57cec5SDimitry Andric equal_to<__iter_value_type<_InputIterator>>, 15600b57cec5SDimitry Andric _Allocator>; 15610b57cec5SDimitry Andric 15620b57cec5SDimitry Andrictemplate<class _Tp, class _Allocator, 1563349cc55cSDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value>> 15640b57cec5SDimitry Andricunordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Allocator) 15650b57cec5SDimitry Andric -> unordered_multiset<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>; 15660b57cec5SDimitry Andric 15670b57cec5SDimitry Andrictemplate<class _Tp, class _Hash, class _Allocator, 1568349cc55cSDimitry Andric class = enable_if_t<!__is_allocator<_Hash>::value>, 1569349cc55cSDimitry Andric class = enable_if_t<!is_integral<_Hash>::value>, 1570349cc55cSDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value>> 15710b57cec5SDimitry Andricunordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator) 15720b57cec5SDimitry Andric -> unordered_multiset<_Tp, _Hash, equal_to<_Tp>, _Allocator>; 15730b57cec5SDimitry Andric#endif 15740b57cec5SDimitry Andric 15750b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 15760b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 15770b57cec5SDimitry Andric size_type __n, const hasher& __hf, const key_equal& __eql) 15780b57cec5SDimitry Andric : __table_(__hf, __eql) 15790b57cec5SDimitry Andric{ 158004eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 15810b57cec5SDimitry Andric __table_.rehash(__n); 15820b57cec5SDimitry Andric} 15830b57cec5SDimitry Andric 15840b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 15850b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 15860b57cec5SDimitry Andric size_type __n, const hasher& __hf, const key_equal& __eql, 15870b57cec5SDimitry Andric const allocator_type& __a) 15880b57cec5SDimitry Andric : __table_(__hf, __eql, __a) 15890b57cec5SDimitry Andric{ 159004eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 15910b57cec5SDimitry Andric __table_.rehash(__n); 15920b57cec5SDimitry Andric} 15930b57cec5SDimitry Andric 15940b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 15950b57cec5SDimitry Andrictemplate <class _InputIterator> 15960b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 15970b57cec5SDimitry Andric _InputIterator __first, _InputIterator __last) 15980b57cec5SDimitry Andric{ 159904eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 16000b57cec5SDimitry Andric insert(__first, __last); 16010b57cec5SDimitry Andric} 16020b57cec5SDimitry Andric 16030b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 16040b57cec5SDimitry Andrictemplate <class _InputIterator> 16050b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 16060b57cec5SDimitry Andric _InputIterator __first, _InputIterator __last, size_type __n, 16070b57cec5SDimitry Andric const hasher& __hf, const key_equal& __eql) 16080b57cec5SDimitry Andric : __table_(__hf, __eql) 16090b57cec5SDimitry Andric{ 161004eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 16110b57cec5SDimitry Andric __table_.rehash(__n); 16120b57cec5SDimitry Andric insert(__first, __last); 16130b57cec5SDimitry Andric} 16140b57cec5SDimitry Andric 16150b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 16160b57cec5SDimitry Andrictemplate <class _InputIterator> 16170b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 16180b57cec5SDimitry Andric _InputIterator __first, _InputIterator __last, size_type __n, 16190b57cec5SDimitry Andric const hasher& __hf, const key_equal& __eql, const allocator_type& __a) 16200b57cec5SDimitry Andric : __table_(__hf, __eql, __a) 16210b57cec5SDimitry Andric{ 162204eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 16230b57cec5SDimitry Andric __table_.rehash(__n); 16240b57cec5SDimitry Andric insert(__first, __last); 16250b57cec5SDimitry Andric} 16260b57cec5SDimitry Andric 16270b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 16280b57cec5SDimitry Andricinline 16290b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 16300b57cec5SDimitry Andric const allocator_type& __a) 16310b57cec5SDimitry Andric : __table_(__a) 16320b57cec5SDimitry Andric{ 163304eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 16340b57cec5SDimitry Andric} 16350b57cec5SDimitry Andric 16360b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 16370b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 16380b57cec5SDimitry Andric const unordered_multiset& __u) 16390b57cec5SDimitry Andric : __table_(__u.__table_) 16400b57cec5SDimitry Andric{ 164104eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 16420b57cec5SDimitry Andric __table_.rehash(__u.bucket_count()); 16430b57cec5SDimitry Andric insert(__u.begin(), __u.end()); 16440b57cec5SDimitry Andric} 16450b57cec5SDimitry Andric 16460b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 16470b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 16480b57cec5SDimitry Andric const unordered_multiset& __u, const allocator_type& __a) 16490b57cec5SDimitry Andric : __table_(__u.__table_, __a) 16500b57cec5SDimitry Andric{ 165104eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 16520b57cec5SDimitry Andric __table_.rehash(__u.bucket_count()); 16530b57cec5SDimitry Andric insert(__u.begin(), __u.end()); 16540b57cec5SDimitry Andric} 16550b57cec5SDimitry Andric 16560b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG 16570b57cec5SDimitry Andric 16580b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 16590b57cec5SDimitry Andricinline 16600b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 16610b57cec5SDimitry Andric unordered_multiset&& __u) 16620b57cec5SDimitry Andric _NOEXCEPT_(is_nothrow_move_constructible<__table>::value) 16630b57cec5SDimitry Andric : __table_(_VSTD::move(__u.__table_)) 16640b57cec5SDimitry Andric{ 166504eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 1666*81ad6265SDimitry Andric std::__debug_db_swap(this, std::addressof(__u)); 16670b57cec5SDimitry Andric} 16680b57cec5SDimitry Andric 16690b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 16700b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 16710b57cec5SDimitry Andric unordered_multiset&& __u, const allocator_type& __a) 16720b57cec5SDimitry Andric : __table_(_VSTD::move(__u.__table_), __a) 16730b57cec5SDimitry Andric{ 167404eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 16750b57cec5SDimitry Andric if (__a != __u.get_allocator()) 16760b57cec5SDimitry Andric { 16770b57cec5SDimitry Andric iterator __i = __u.begin(); 16780b57cec5SDimitry Andric while (__u.size() != 0) 16790b57cec5SDimitry Andric __table_.__insert_multi(_VSTD::move(__u.__table_.remove(__i++)->__value_)); 16800b57cec5SDimitry Andric } 16810b57cec5SDimitry Andric else 1682*81ad6265SDimitry Andric std::__debug_db_swap(this, std::addressof(__u)); 16830b57cec5SDimitry Andric} 16840b57cec5SDimitry Andric 16850b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 16860b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 16870b57cec5SDimitry Andric initializer_list<value_type> __il) 16880b57cec5SDimitry Andric{ 168904eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 16900b57cec5SDimitry Andric insert(__il.begin(), __il.end()); 16910b57cec5SDimitry Andric} 16920b57cec5SDimitry Andric 16930b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 16940b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 16950b57cec5SDimitry Andric initializer_list<value_type> __il, size_type __n, const hasher& __hf, 16960b57cec5SDimitry Andric const key_equal& __eql) 16970b57cec5SDimitry Andric : __table_(__hf, __eql) 16980b57cec5SDimitry Andric{ 169904eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 17000b57cec5SDimitry Andric __table_.rehash(__n); 17010b57cec5SDimitry Andric insert(__il.begin(), __il.end()); 17020b57cec5SDimitry Andric} 17030b57cec5SDimitry Andric 17040b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 17050b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 17060b57cec5SDimitry Andric initializer_list<value_type> __il, size_type __n, const hasher& __hf, 17070b57cec5SDimitry Andric const key_equal& __eql, const allocator_type& __a) 17080b57cec5SDimitry Andric : __table_(__hf, __eql, __a) 17090b57cec5SDimitry Andric{ 171004eeddc0SDimitry Andric _VSTD::__debug_db_insert_c(this); 17110b57cec5SDimitry Andric __table_.rehash(__n); 17120b57cec5SDimitry Andric insert(__il.begin(), __il.end()); 17130b57cec5SDimitry Andric} 17140b57cec5SDimitry Andric 17150b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 17160b57cec5SDimitry Andricinline 17170b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>& 17180b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=( 17190b57cec5SDimitry Andric unordered_multiset&& __u) 17200b57cec5SDimitry Andric _NOEXCEPT_(is_nothrow_move_assignable<__table>::value) 17210b57cec5SDimitry Andric{ 17220b57cec5SDimitry Andric __table_ = _VSTD::move(__u.__table_); 17230b57cec5SDimitry Andric return *this; 17240b57cec5SDimitry Andric} 17250b57cec5SDimitry Andric 17260b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 17270b57cec5SDimitry Andricinline 17280b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>& 17290b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=( 17300b57cec5SDimitry Andric initializer_list<value_type> __il) 17310b57cec5SDimitry Andric{ 17320b57cec5SDimitry Andric __table_.__assign_multi(__il.begin(), __il.end()); 17330b57cec5SDimitry Andric return *this; 17340b57cec5SDimitry Andric} 17350b57cec5SDimitry Andric 17360b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG 17370b57cec5SDimitry Andric 17380b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 17390b57cec5SDimitry Andrictemplate <class _InputIterator> 17400b57cec5SDimitry Andricinline 17410b57cec5SDimitry Andricvoid 17420b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, 17430b57cec5SDimitry Andric _InputIterator __last) 17440b57cec5SDimitry Andric{ 17450b57cec5SDimitry Andric for (; __first != __last; ++__first) 17460b57cec5SDimitry Andric __table_.__insert_multi(*__first); 17470b57cec5SDimitry Andric} 17480b57cec5SDimitry Andric 17490b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 17500b57cec5SDimitry Andricinline _LIBCPP_INLINE_VISIBILITY 17510b57cec5SDimitry Andricvoid 17520b57cec5SDimitry Andricswap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, 17530b57cec5SDimitry Andric unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) 17540b57cec5SDimitry Andric _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) 17550b57cec5SDimitry Andric{ 17560b57cec5SDimitry Andric __x.swap(__y); 17570b57cec5SDimitry Andric} 17580b57cec5SDimitry Andric 17590b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 17 17605ffd83dbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc, 17615ffd83dbSDimitry Andric class _Predicate> 17620b57cec5SDimitry Andricinline _LIBCPP_INLINE_VISIBILITY 17635ffd83dbSDimitry Andric typename unordered_multiset<_Value, _Hash, _Pred, _Alloc>::size_type 17645ffd83dbSDimitry Andric erase_if(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __c, 17655ffd83dbSDimitry Andric _Predicate __pred) { 1766fe6060f1SDimitry Andric return _VSTD::__libcpp_erase_if_container(__c, __pred); 17675ffd83dbSDimitry Andric} 17680b57cec5SDimitry Andric#endif 17690b57cec5SDimitry Andric 17700b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 17710b57cec5SDimitry Andricbool 17720b57cec5SDimitry Andricoperator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, 17730b57cec5SDimitry Andric const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) 17740b57cec5SDimitry Andric{ 17750b57cec5SDimitry Andric if (__x.size() != __y.size()) 17760b57cec5SDimitry Andric return false; 17770b57cec5SDimitry Andric typedef typename unordered_multiset<_Value, _Hash, _Pred, _Alloc>::const_iterator 17780b57cec5SDimitry Andric const_iterator; 17790b57cec5SDimitry Andric typedef pair<const_iterator, const_iterator> _EqRng; 17800b57cec5SDimitry Andric for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;) 17810b57cec5SDimitry Andric { 17820b57cec5SDimitry Andric _EqRng __xeq = __x.equal_range(*__i); 17830b57cec5SDimitry Andric _EqRng __yeq = __y.equal_range(*__i); 17840b57cec5SDimitry Andric if (_VSTD::distance(__xeq.first, __xeq.second) != 17850b57cec5SDimitry Andric _VSTD::distance(__yeq.first, __yeq.second) || 17860b57cec5SDimitry Andric !_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first)) 17870b57cec5SDimitry Andric return false; 17880b57cec5SDimitry Andric __i = __xeq.second; 17890b57cec5SDimitry Andric } 17900b57cec5SDimitry Andric return true; 17910b57cec5SDimitry Andric} 17920b57cec5SDimitry Andric 17930b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc> 17940b57cec5SDimitry Andricinline _LIBCPP_INLINE_VISIBILITY 17950b57cec5SDimitry Andricbool 17960b57cec5SDimitry Andricoperator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, 17970b57cec5SDimitry Andric const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) 17980b57cec5SDimitry Andric{ 17990b57cec5SDimitry Andric return !(__x == __y); 18000b57cec5SDimitry Andric} 18010b57cec5SDimitry Andric 18020b57cec5SDimitry Andric_LIBCPP_END_NAMESPACE_STD 18030b57cec5SDimitry Andric 18040b57cec5SDimitry Andric#endif // _LIBCPP_UNORDERED_SET 1805