146035553Spatrick// -*- C++ -*- 2*4bdff4beSrobert//===----------------------------------------------------------------------===// 346035553Spatrick// 446035553Spatrick// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 546035553Spatrick// See https://llvm.org/LICENSE.txt for license information. 646035553Spatrick// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 746035553Spatrick// 846035553Spatrick//===----------------------------------------------------------------------===// 946035553Spatrick 1046035553Spatrick#ifndef _LIBCPP_UNORDERED_SET 1146035553Spatrick#define _LIBCPP_UNORDERED_SET 1246035553Spatrick 1346035553Spatrick/* 1446035553Spatrick 1546035553Spatrick unordered_set synopsis 1646035553Spatrick 1746035553Spatrick#include <initializer_list> 1846035553Spatrick 1946035553Spatricknamespace std 2046035553Spatrick{ 2146035553Spatrick 2246035553Spatricktemplate <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, 2346035553Spatrick class Alloc = allocator<Value>> 2446035553Spatrickclass unordered_set 2546035553Spatrick{ 2646035553Spatrickpublic: 2746035553Spatrick // types 2846035553Spatrick typedef Value key_type; 2946035553Spatrick typedef key_type value_type; 3046035553Spatrick typedef Hash hasher; 3146035553Spatrick typedef Pred key_equal; 3246035553Spatrick typedef Alloc allocator_type; 3346035553Spatrick typedef value_type& reference; 3446035553Spatrick typedef const value_type& const_reference; 3546035553Spatrick typedef typename allocator_traits<allocator_type>::pointer pointer; 3646035553Spatrick typedef typename allocator_traits<allocator_type>::const_pointer const_pointer; 3746035553Spatrick typedef typename allocator_traits<allocator_type>::size_type size_type; 3846035553Spatrick typedef typename allocator_traits<allocator_type>::difference_type difference_type; 3946035553Spatrick 4046035553Spatrick typedef /unspecified/ iterator; 4146035553Spatrick typedef /unspecified/ const_iterator; 4246035553Spatrick typedef /unspecified/ local_iterator; 4346035553Spatrick typedef /unspecified/ const_local_iterator; 4446035553Spatrick 4546035553Spatrick typedef unspecified node_type unspecified; // C++17 4646035553Spatrick typedef INSERT_RETURN_TYPE<iterator, node_type> insert_return_type; // C++17 4746035553Spatrick 4846035553Spatrick unordered_set() 4946035553Spatrick noexcept( 5046035553Spatrick is_nothrow_default_constructible<hasher>::value && 5146035553Spatrick is_nothrow_default_constructible<key_equal>::value && 5246035553Spatrick is_nothrow_default_constructible<allocator_type>::value); 5346035553Spatrick explicit unordered_set(size_type n, const hasher& hf = hasher(), 5446035553Spatrick const key_equal& eql = key_equal(), 5546035553Spatrick const allocator_type& a = allocator_type()); 5646035553Spatrick template <class InputIterator> 5746035553Spatrick unordered_set(InputIterator f, InputIterator l, 5846035553Spatrick size_type n = 0, const hasher& hf = hasher(), 5946035553Spatrick const key_equal& eql = key_equal(), 6046035553Spatrick const allocator_type& a = allocator_type()); 6146035553Spatrick explicit unordered_set(const allocator_type&); 6246035553Spatrick unordered_set(const unordered_set&); 6346035553Spatrick unordered_set(const unordered_set&, const Allocator&); 6446035553Spatrick unordered_set(unordered_set&&) 6546035553Spatrick noexcept( 6646035553Spatrick is_nothrow_move_constructible<hasher>::value && 6746035553Spatrick is_nothrow_move_constructible<key_equal>::value && 6846035553Spatrick is_nothrow_move_constructible<allocator_type>::value); 6946035553Spatrick unordered_set(unordered_set&&, const Allocator&); 7046035553Spatrick unordered_set(initializer_list<value_type>, size_type n = 0, 7146035553Spatrick const hasher& hf = hasher(), const key_equal& eql = key_equal(), 7246035553Spatrick const allocator_type& a = allocator_type()); 7346035553Spatrick unordered_set(size_type n, const allocator_type& a); // C++14 7446035553Spatrick unordered_set(size_type n, const hasher& hf, const allocator_type& a); // C++14 7546035553Spatrick template <class InputIterator> 7646035553Spatrick unordered_set(InputIterator f, InputIterator l, size_type n, const allocator_type& a); // C++14 7746035553Spatrick template <class InputIterator> 7846035553Spatrick unordered_set(InputIterator f, InputIterator l, size_type n, 7946035553Spatrick const hasher& hf, const allocator_type& a); // C++14 8046035553Spatrick unordered_set(initializer_list<value_type> il, size_type n, const allocator_type& a); // C++14 8146035553Spatrick unordered_set(initializer_list<value_type> il, size_type n, 8246035553Spatrick const hasher& hf, const allocator_type& a); // C++14 8346035553Spatrick ~unordered_set(); 8446035553Spatrick unordered_set& operator=(const unordered_set&); 8546035553Spatrick unordered_set& operator=(unordered_set&&) 8646035553Spatrick noexcept( 8746035553Spatrick allocator_type::propagate_on_container_move_assignment::value && 8846035553Spatrick is_nothrow_move_assignable<allocator_type>::value && 8946035553Spatrick is_nothrow_move_assignable<hasher>::value && 9046035553Spatrick is_nothrow_move_assignable<key_equal>::value); 9146035553Spatrick unordered_set& operator=(initializer_list<value_type>); 9246035553Spatrick 9346035553Spatrick allocator_type get_allocator() const noexcept; 9446035553Spatrick 9546035553Spatrick bool empty() const noexcept; 9646035553Spatrick size_type size() const noexcept; 9746035553Spatrick size_type max_size() const noexcept; 9846035553Spatrick 9946035553Spatrick iterator begin() noexcept; 10046035553Spatrick iterator end() noexcept; 10146035553Spatrick const_iterator begin() const noexcept; 10246035553Spatrick const_iterator end() const noexcept; 10346035553Spatrick const_iterator cbegin() const noexcept; 10446035553Spatrick const_iterator cend() const noexcept; 10546035553Spatrick 10646035553Spatrick template <class... Args> 10746035553Spatrick pair<iterator, bool> emplace(Args&&... args); 10846035553Spatrick template <class... Args> 10946035553Spatrick iterator emplace_hint(const_iterator position, Args&&... args); 11046035553Spatrick pair<iterator, bool> insert(const value_type& obj); 11146035553Spatrick pair<iterator, bool> insert(value_type&& obj); 11246035553Spatrick iterator insert(const_iterator hint, const value_type& obj); 11346035553Spatrick iterator insert(const_iterator hint, value_type&& obj); 11446035553Spatrick template <class InputIterator> 11546035553Spatrick void insert(InputIterator first, InputIterator last); 11646035553Spatrick void insert(initializer_list<value_type>); 11746035553Spatrick 11846035553Spatrick node_type extract(const_iterator position); // C++17 11946035553Spatrick node_type extract(const key_type& x); // C++17 12046035553Spatrick insert_return_type insert(node_type&& nh); // C++17 12146035553Spatrick iterator insert(const_iterator hint, node_type&& nh); // C++17 12246035553Spatrick 12346035553Spatrick iterator erase(const_iterator position); 12446035553Spatrick iterator erase(iterator position); // C++14 12546035553Spatrick size_type erase(const key_type& k); 12646035553Spatrick iterator erase(const_iterator first, const_iterator last); 12746035553Spatrick void clear() noexcept; 12846035553Spatrick 12946035553Spatrick template<class H2, class P2> 13046035553Spatrick void merge(unordered_set<Key, H2, P2, Allocator>& source); // C++17 13146035553Spatrick template<class H2, class P2> 13246035553Spatrick void merge(unordered_set<Key, H2, P2, Allocator>&& source); // C++17 13346035553Spatrick template<class H2, class P2> 13446035553Spatrick void merge(unordered_multiset<Key, H2, P2, Allocator>& source); // C++17 13546035553Spatrick template<class H2, class P2> 13646035553Spatrick void merge(unordered_multiset<Key, H2, P2, Allocator>&& source); // C++17 13746035553Spatrick 13846035553Spatrick void swap(unordered_set&) 13946035553Spatrick noexcept(allocator_traits<Allocator>::is_always_equal::value && 14046035553Spatrick noexcept(swap(declval<hasher&>(), declval<hasher&>())) && 14146035553Spatrick noexcept(swap(declval<key_equal&>(), declval<key_equal&>()))); // C++17 14246035553Spatrick 14346035553Spatrick hasher hash_function() const; 14446035553Spatrick key_equal key_eq() const; 14546035553Spatrick 14646035553Spatrick iterator find(const key_type& k); 14746035553Spatrick const_iterator find(const key_type& k) const; 14876d0caaeSpatrick template<typename K> 14976d0caaeSpatrick iterator find(const K& x); // C++20 15076d0caaeSpatrick template<typename K> 15176d0caaeSpatrick const_iterator find(const K& x) const; // C++20 15246035553Spatrick size_type count(const key_type& k) const; 15376d0caaeSpatrick template<typename K> 15476d0caaeSpatrick size_type count(const K& k) const; // C++20 15546035553Spatrick bool contains(const key_type& k) const; // C++20 15676d0caaeSpatrick template<typename K> 15776d0caaeSpatrick bool contains(const K& k) const; // C++20 15846035553Spatrick pair<iterator, iterator> equal_range(const key_type& k); 15946035553Spatrick pair<const_iterator, const_iterator> equal_range(const key_type& k) const; 16076d0caaeSpatrick template<typename K> 16176d0caaeSpatrick pair<iterator, iterator> equal_range(const K& k); // C++20 16276d0caaeSpatrick template<typename K> 16376d0caaeSpatrick pair<const_iterator, const_iterator> equal_range(const K& k) const; // C++20 16446035553Spatrick 16546035553Spatrick size_type bucket_count() const noexcept; 16646035553Spatrick size_type max_bucket_count() const noexcept; 16746035553Spatrick 16846035553Spatrick size_type bucket_size(size_type n) const; 16946035553Spatrick size_type bucket(const key_type& k) const; 17046035553Spatrick 17146035553Spatrick local_iterator begin(size_type n); 17246035553Spatrick local_iterator end(size_type n); 17346035553Spatrick const_local_iterator begin(size_type n) const; 17446035553Spatrick const_local_iterator end(size_type n) const; 17546035553Spatrick const_local_iterator cbegin(size_type n) const; 17646035553Spatrick const_local_iterator cend(size_type n) const; 17746035553Spatrick 17846035553Spatrick float load_factor() const noexcept; 17946035553Spatrick float max_load_factor() const noexcept; 18046035553Spatrick void max_load_factor(float z); 18146035553Spatrick void rehash(size_type n); 18246035553Spatrick void reserve(size_type n); 18346035553Spatrick}; 18446035553Spatrick 185*4bdff4beSroberttemplate<class InputIterator, 186*4bdff4beSrobert class Hash = hash<typename iterator_traits<InputIterator>::value_type>, 187*4bdff4beSrobert class Pred = equal_to<typename iterator_traits<InputIterator>::value_type>, 188*4bdff4beSrobert class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>> 189*4bdff4beSrobertunordered_set(InputIterator, InputIterator, typename see below::size_type = see below, 190*4bdff4beSrobert Hash = Hash(), Pred = Pred(), Allocator = Allocator()) 191*4bdff4beSrobert -> unordered_set<typename iterator_traits<InputIterator>::value_type, 192*4bdff4beSrobert Hash, Pred, Allocator>; // C++17 193*4bdff4beSrobert 194*4bdff4beSroberttemplate<class T, class Hash = hash<T>, 195*4bdff4beSrobert class Pred = equal_to<T>, class Allocator = allocator<T>> 196*4bdff4beSrobertunordered_set(initializer_list<T>, typename see below::size_type = see below, 197*4bdff4beSrobert Hash = Hash(), Pred = Pred(), Allocator = Allocator()) 198*4bdff4beSrobert -> unordered_set<T, Hash, Pred, Allocator>; // C++17 199*4bdff4beSrobert 200*4bdff4beSroberttemplate<class InputIterator, class Allocator> 201*4bdff4beSrobertunordered_set(InputIterator, InputIterator, typename see below::size_type, Allocator) 202*4bdff4beSrobert -> unordered_set<typename iterator_traits<InputIterator>::value_type, 203*4bdff4beSrobert hash<typename iterator_traits<InputIterator>::value_type>, 204*4bdff4beSrobert equal_to<typename iterator_traits<InputIterator>::value_type>, 205*4bdff4beSrobert Allocator>; // C++17 206*4bdff4beSrobert 207*4bdff4beSroberttemplate<class InputIterator, class Hash, class Allocator> 208*4bdff4beSrobertunordered_set(InputIterator, InputIterator, typename see below::size_type, 209*4bdff4beSrobert Hash, Allocator) 210*4bdff4beSrobert -> unordered_set<typename iterator_traits<InputIterator>::value_type, Hash, 211*4bdff4beSrobert equal_to<typename iterator_traits<InputIterator>::value_type>, 212*4bdff4beSrobert Allocator>; // C++17 213*4bdff4beSrobert 214*4bdff4beSroberttemplate<class T, class Allocator> 215*4bdff4beSrobertunordered_set(initializer_list<T>, typename see below::size_type, Allocator) 216*4bdff4beSrobert -> unordered_set<T, hash<T>, equal_to<T>, Allocator>; // C++17 217*4bdff4beSrobert 218*4bdff4beSroberttemplate<class T, class Hash, class Allocator> 219*4bdff4beSrobertunordered_set(initializer_list<T>, typename see below::size_type, Hash, Allocator) 220*4bdff4beSrobert -> unordered_set<T, Hash, equal_to<T>, Allocator>; // C++17 221*4bdff4beSrobert 22246035553Spatricktemplate <class Value, class Hash, class Pred, class Alloc> 22346035553Spatrick void swap(unordered_set<Value, Hash, Pred, Alloc>& x, 22446035553Spatrick unordered_set<Value, Hash, Pred, Alloc>& y) 22546035553Spatrick noexcept(noexcept(x.swap(y))); 22646035553Spatrick 22746035553Spatricktemplate <class Value, class Hash, class Pred, class Alloc> 22846035553Spatrick bool 22946035553Spatrick operator==(const unordered_set<Value, Hash, Pred, Alloc>& x, 23046035553Spatrick const unordered_set<Value, Hash, Pred, Alloc>& y); 23146035553Spatrick 23246035553Spatricktemplate <class Value, class Hash, class Pred, class Alloc> 23346035553Spatrick bool 23446035553Spatrick operator!=(const unordered_set<Value, Hash, Pred, Alloc>& x, 23546035553Spatrick const unordered_set<Value, Hash, Pred, Alloc>& y); 23646035553Spatrick 23746035553Spatricktemplate <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, 23846035553Spatrick class Alloc = allocator<Value>> 23946035553Spatrickclass unordered_multiset 24046035553Spatrick{ 24146035553Spatrickpublic: 24246035553Spatrick // types 24346035553Spatrick typedef Value key_type; 24446035553Spatrick typedef key_type value_type; 24546035553Spatrick typedef Hash hasher; 24646035553Spatrick typedef Pred key_equal; 24746035553Spatrick typedef Alloc allocator_type; 24846035553Spatrick typedef value_type& reference; 24946035553Spatrick typedef const value_type& const_reference; 25046035553Spatrick typedef typename allocator_traits<allocator_type>::pointer pointer; 25146035553Spatrick typedef typename allocator_traits<allocator_type>::const_pointer const_pointer; 25246035553Spatrick typedef typename allocator_traits<allocator_type>::size_type size_type; 25346035553Spatrick typedef typename allocator_traits<allocator_type>::difference_type difference_type; 25446035553Spatrick 25546035553Spatrick typedef /unspecified/ iterator; 25646035553Spatrick typedef /unspecified/ const_iterator; 25746035553Spatrick typedef /unspecified/ local_iterator; 25846035553Spatrick typedef /unspecified/ const_local_iterator; 25946035553Spatrick 26046035553Spatrick typedef unspecified node_type unspecified; // C++17 26146035553Spatrick 26246035553Spatrick unordered_multiset() 26346035553Spatrick noexcept( 26446035553Spatrick is_nothrow_default_constructible<hasher>::value && 26546035553Spatrick is_nothrow_default_constructible<key_equal>::value && 26646035553Spatrick is_nothrow_default_constructible<allocator_type>::value); 26746035553Spatrick explicit unordered_multiset(size_type n, const hasher& hf = hasher(), 26846035553Spatrick const key_equal& eql = key_equal(), 26946035553Spatrick const allocator_type& a = allocator_type()); 27046035553Spatrick template <class InputIterator> 27146035553Spatrick unordered_multiset(InputIterator f, InputIterator l, 27246035553Spatrick size_type n = 0, const hasher& hf = hasher(), 27346035553Spatrick const key_equal& eql = key_equal(), 27446035553Spatrick const allocator_type& a = allocator_type()); 27546035553Spatrick explicit unordered_multiset(const allocator_type&); 27646035553Spatrick unordered_multiset(const unordered_multiset&); 27746035553Spatrick unordered_multiset(const unordered_multiset&, const Allocator&); 27846035553Spatrick unordered_multiset(unordered_multiset&&) 27946035553Spatrick noexcept( 28046035553Spatrick is_nothrow_move_constructible<hasher>::value && 28146035553Spatrick is_nothrow_move_constructible<key_equal>::value && 28246035553Spatrick is_nothrow_move_constructible<allocator_type>::value); 28346035553Spatrick unordered_multiset(unordered_multiset&&, const Allocator&); 28446035553Spatrick unordered_multiset(initializer_list<value_type>, size_type n = /see below/, 28546035553Spatrick const hasher& hf = hasher(), const key_equal& eql = key_equal(), 28646035553Spatrick const allocator_type& a = allocator_type()); 28746035553Spatrick unordered_multiset(size_type n, const allocator_type& a); // C++14 28846035553Spatrick unordered_multiset(size_type n, const hasher& hf, const allocator_type& a); // C++14 28946035553Spatrick template <class InputIterator> 29046035553Spatrick unordered_multiset(InputIterator f, InputIterator l, size_type n, const allocator_type& a); // C++14 29146035553Spatrick template <class InputIterator> 29246035553Spatrick unordered_multiset(InputIterator f, InputIterator l, size_type n, 29346035553Spatrick const hasher& hf, const allocator_type& a); // C++14 29446035553Spatrick unordered_multiset(initializer_list<value_type> il, size_type n, const allocator_type& a); // C++14 29546035553Spatrick unordered_multiset(initializer_list<value_type> il, size_type n, 29646035553Spatrick const hasher& hf, const allocator_type& a); // C++14 29746035553Spatrick ~unordered_multiset(); 29846035553Spatrick unordered_multiset& operator=(const unordered_multiset&); 29946035553Spatrick unordered_multiset& operator=(unordered_multiset&&) 30046035553Spatrick noexcept( 30146035553Spatrick allocator_type::propagate_on_container_move_assignment::value && 30246035553Spatrick is_nothrow_move_assignable<allocator_type>::value && 30346035553Spatrick is_nothrow_move_assignable<hasher>::value && 30446035553Spatrick is_nothrow_move_assignable<key_equal>::value); 30546035553Spatrick unordered_multiset& operator=(initializer_list<value_type>); 30646035553Spatrick 30746035553Spatrick allocator_type get_allocator() const noexcept; 30846035553Spatrick 30946035553Spatrick bool empty() const noexcept; 31046035553Spatrick size_type size() const noexcept; 31146035553Spatrick size_type max_size() const noexcept; 31246035553Spatrick 31346035553Spatrick iterator begin() noexcept; 31446035553Spatrick iterator end() noexcept; 31546035553Spatrick const_iterator begin() const noexcept; 31646035553Spatrick const_iterator end() const noexcept; 31746035553Spatrick const_iterator cbegin() const noexcept; 31846035553Spatrick const_iterator cend() const noexcept; 31946035553Spatrick 32046035553Spatrick template <class... Args> 32146035553Spatrick iterator emplace(Args&&... args); 32246035553Spatrick template <class... Args> 32346035553Spatrick iterator emplace_hint(const_iterator position, Args&&... args); 32446035553Spatrick iterator insert(const value_type& obj); 32546035553Spatrick iterator insert(value_type&& obj); 32646035553Spatrick iterator insert(const_iterator hint, const value_type& obj); 32746035553Spatrick iterator insert(const_iterator hint, value_type&& obj); 32846035553Spatrick template <class InputIterator> 32946035553Spatrick void insert(InputIterator first, InputIterator last); 33046035553Spatrick void insert(initializer_list<value_type>); 33146035553Spatrick 33246035553Spatrick node_type extract(const_iterator position); // C++17 33346035553Spatrick node_type extract(const key_type& x); // C++17 33446035553Spatrick iterator insert(node_type&& nh); // C++17 33546035553Spatrick iterator insert(const_iterator hint, node_type&& nh); // C++17 33646035553Spatrick 33746035553Spatrick iterator erase(const_iterator position); 33846035553Spatrick iterator erase(iterator position); // C++14 33946035553Spatrick size_type erase(const key_type& k); 34046035553Spatrick iterator erase(const_iterator first, const_iterator last); 34146035553Spatrick void clear() noexcept; 34246035553Spatrick 34346035553Spatrick template<class H2, class P2> 34446035553Spatrick void merge(unordered_multiset<Key, H2, P2, Allocator>& source); // C++17 34546035553Spatrick template<class H2, class P2> 34646035553Spatrick void merge(unordered_multiset<Key, H2, P2, Allocator>&& source); // C++17 34746035553Spatrick template<class H2, class P2> 34846035553Spatrick void merge(unordered_set<Key, H2, P2, Allocator>& source); // C++17 34946035553Spatrick template<class H2, class P2> 35046035553Spatrick void merge(unordered_set<Key, H2, P2, Allocator>&& source); // C++17 35146035553Spatrick 35246035553Spatrick void swap(unordered_multiset&) 35346035553Spatrick noexcept(allocator_traits<Allocator>::is_always_equal::value && 35446035553Spatrick noexcept(swap(declval<hasher&>(), declval<hasher&>())) && 35546035553Spatrick noexcept(swap(declval<key_equal&>(), declval<key_equal&>()))); // C++17 35646035553Spatrick 35746035553Spatrick hasher hash_function() const; 35846035553Spatrick key_equal key_eq() const; 35946035553Spatrick 36046035553Spatrick iterator find(const key_type& k); 36146035553Spatrick const_iterator find(const key_type& k) const; 36276d0caaeSpatrick template<typename K> 36376d0caaeSpatrick iterator find(const K& x); // C++20 36476d0caaeSpatrick template<typename K> 36576d0caaeSpatrick const_iterator find(const K& x) const; // C++20 36646035553Spatrick size_type count(const key_type& k) const; 36776d0caaeSpatrick template<typename K> 36876d0caaeSpatrick size_type count(const K& k) const; // C++20 36946035553Spatrick bool contains(const key_type& k) const; // C++20 37076d0caaeSpatrick template<typename K> 37176d0caaeSpatrick bool contains(const K& k) const; // C++20 37246035553Spatrick pair<iterator, iterator> equal_range(const key_type& k); 37346035553Spatrick pair<const_iterator, const_iterator> equal_range(const key_type& k) const; 37476d0caaeSpatrick template<typename K> 37576d0caaeSpatrick pair<iterator, iterator> equal_range(const K& k); // C++20 37676d0caaeSpatrick template<typename K> 37776d0caaeSpatrick pair<const_iterator, const_iterator> equal_range(const K& k) const; // C++20 37846035553Spatrick 37946035553Spatrick size_type bucket_count() const noexcept; 38046035553Spatrick size_type max_bucket_count() const noexcept; 38146035553Spatrick 38246035553Spatrick size_type bucket_size(size_type n) const; 38346035553Spatrick size_type bucket(const key_type& k) const; 38446035553Spatrick 38546035553Spatrick local_iterator begin(size_type n); 38646035553Spatrick local_iterator end(size_type n); 38746035553Spatrick const_local_iterator begin(size_type n) const; 38846035553Spatrick const_local_iterator end(size_type n) const; 38946035553Spatrick const_local_iterator cbegin(size_type n) const; 39046035553Spatrick const_local_iterator cend(size_type n) const; 39146035553Spatrick 39246035553Spatrick float load_factor() const noexcept; 39346035553Spatrick float max_load_factor() const noexcept; 39446035553Spatrick void max_load_factor(float z); 39546035553Spatrick void rehash(size_type n); 39646035553Spatrick void reserve(size_type n); 39746035553Spatrick}; 39846035553Spatrick 399*4bdff4beSroberttemplate<class InputIterator, 400*4bdff4beSrobert class Hash = hash<typename iterator_traits<InputIterator>::value_type>, 401*4bdff4beSrobert class Pred = equal_to<typename iterator_traits<InputIterator>::value_type>, 402*4bdff4beSrobert class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>> 403*4bdff4beSrobertunordered_multiset(InputIterator, InputIterator, see below::size_type = see below, 404*4bdff4beSrobert Hash = Hash(), Pred = Pred(), Allocator = Allocator()) 405*4bdff4beSrobert -> unordered_multiset<typename iterator_traits<InputIterator>::value_type, 406*4bdff4beSrobert Hash, Pred, Allocator>; // C++17 407*4bdff4beSrobert 408*4bdff4beSroberttemplate<class T, class Hash = hash<T>, 409*4bdff4beSrobert class Pred = equal_to<T>, class Allocator = allocator<T>> 410*4bdff4beSrobertunordered_multiset(initializer_list<T>, typename see below::size_type = see below, 411*4bdff4beSrobert Hash = Hash(), Pred = Pred(), Allocator = Allocator()) 412*4bdff4beSrobert -> unordered_multiset<T, Hash, Pred, Allocator>; // C++17 413*4bdff4beSrobert 414*4bdff4beSroberttemplate<class InputIterator, class Allocator> 415*4bdff4beSrobertunordered_multiset(InputIterator, InputIterator, typename see below::size_type, Allocator) 416*4bdff4beSrobert -> unordered_multiset<typename iterator_traits<InputIterator>::value_type, 417*4bdff4beSrobert hash<typename iterator_traits<InputIterator>::value_type>, 418*4bdff4beSrobert equal_to<typename iterator_traits<InputIterator>::value_type>, 419*4bdff4beSrobert Allocator>; // C++17 420*4bdff4beSrobert 421*4bdff4beSroberttemplate<class InputIterator, class Hash, class Allocator> 422*4bdff4beSrobertunordered_multiset(InputIterator, InputIterator, typename see below::size_type, 423*4bdff4beSrobert Hash, Allocator) 424*4bdff4beSrobert -> unordered_multiset<typename iterator_traits<InputIterator>::value_type, Hash, 425*4bdff4beSrobert equal_to<typename iterator_traits<InputIterator>::value_type>, Allocator>; // C++17 426*4bdff4beSrobert 427*4bdff4beSroberttemplate<class T, class Allocator> 428*4bdff4beSrobertunordered_multiset(initializer_list<T>, typename see below::size_type, Allocator) 429*4bdff4beSrobert -> unordered_multiset<T, hash<T>, equal_to<T>, Allocator>; // C++17 430*4bdff4beSrobert 431*4bdff4beSroberttemplate<class T, class Hash, class Allocator> 432*4bdff4beSrobertunordered_multiset(initializer_list<T>, typename see below::size_type, Hash, Allocator) 433*4bdff4beSrobert -> unordered_multiset<T, Hash, equal_to<T>, Allocator>; // C++17 434*4bdff4beSrobert 43546035553Spatricktemplate <class Value, class Hash, class Pred, class Alloc> 43646035553Spatrick void swap(unordered_multiset<Value, Hash, Pred, Alloc>& x, 43746035553Spatrick unordered_multiset<Value, Hash, Pred, Alloc>& y) 43846035553Spatrick noexcept(noexcept(x.swap(y))); 43946035553Spatrick 44046035553Spatricktemplate <class K, class T, class H, class P, class A, class Predicate> 441037e7968Spatrick typename unordered_set<K, T, H, P, A>::size_type 442037e7968Spatrick erase_if(unordered_set<K, T, H, P, A>& c, Predicate pred); // C++20 44346035553Spatrick 44446035553Spatricktemplate <class K, class T, class H, class P, class A, class Predicate> 445037e7968Spatrick typename unordered_multiset<K, T, H, P, A>::size_type 446037e7968Spatrick erase_if(unordered_multiset<K, T, H, P, A>& c, Predicate pred); // C++20 44746035553Spatrick 44846035553Spatrick 44946035553Spatricktemplate <class Value, class Hash, class Pred, class Alloc> 45046035553Spatrick bool 45146035553Spatrick operator==(const unordered_multiset<Value, Hash, Pred, Alloc>& x, 45246035553Spatrick const unordered_multiset<Value, Hash, Pred, Alloc>& y); 45346035553Spatrick 45446035553Spatricktemplate <class Value, class Hash, class Pred, class Alloc> 45546035553Spatrick bool 45646035553Spatrick operator!=(const unordered_multiset<Value, Hash, Pred, Alloc>& x, 45746035553Spatrick const unordered_multiset<Value, Hash, Pred, Alloc>& y); 45846035553Spatrick} // std 45946035553Spatrick 46046035553Spatrick*/ 46146035553Spatrick 462*4bdff4beSrobert#include <__algorithm/is_permutation.h> 463*4bdff4beSrobert#include <__assert> // all public C++ headers provide the assertion handler 46446035553Spatrick#include <__config> 46576d0caaeSpatrick#include <__debug> 46676d0caaeSpatrick#include <__functional/is_transparent.h> 467*4bdff4beSrobert#include <__functional/operations.h> 46846035553Spatrick#include <__hash_table> 469*4bdff4beSrobert#include <__iterator/distance.h> 470*4bdff4beSrobert#include <__iterator/erase_if_container.h> 471*4bdff4beSrobert#include <__iterator/iterator_traits.h> 472*4bdff4beSrobert#include <__memory/addressof.h> 473*4bdff4beSrobert#include <__memory/allocator.h> 474*4bdff4beSrobert#include <__memory_resource/polymorphic_allocator.h> 47546035553Spatrick#include <__node_handle> 476*4bdff4beSrobert#include <__type_traits/is_allocator.h> 47776d0caaeSpatrick#include <__utility/forward.h> 47846035553Spatrick#include <version> 47946035553Spatrick 480*4bdff4beSrobert// standard-mandated includes 481*4bdff4beSrobert 482*4bdff4beSrobert// [iterator.range] 483*4bdff4beSrobert#include <__iterator/access.h> 484*4bdff4beSrobert#include <__iterator/data.h> 485*4bdff4beSrobert#include <__iterator/empty.h> 486*4bdff4beSrobert#include <__iterator/reverse_access.h> 487*4bdff4beSrobert#include <__iterator/size.h> 488*4bdff4beSrobert 489*4bdff4beSrobert// [unord.set.syn] 490*4bdff4beSrobert#include <compare> 491*4bdff4beSrobert#include <initializer_list> 492*4bdff4beSrobert 49346035553Spatrick#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 49446035553Spatrick# pragma GCC system_header 49546035553Spatrick#endif 49646035553Spatrick 49746035553Spatrick_LIBCPP_BEGIN_NAMESPACE_STD 49846035553Spatrick 49946035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 50046035553Spatrickclass unordered_multiset; 50146035553Spatrick 50246035553Spatricktemplate <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>, 50346035553Spatrick class _Alloc = allocator<_Value> > 50446035553Spatrickclass _LIBCPP_TEMPLATE_VIS unordered_set 50546035553Spatrick{ 50646035553Spatrickpublic: 50746035553Spatrick // types 50846035553Spatrick typedef _Value key_type; 50946035553Spatrick typedef key_type value_type; 510*4bdff4beSrobert typedef __type_identity_t<_Hash> hasher; 511*4bdff4beSrobert typedef __type_identity_t<_Pred> key_equal; 512*4bdff4beSrobert typedef __type_identity_t<_Alloc> allocator_type; 51346035553Spatrick typedef value_type& reference; 51446035553Spatrick typedef const value_type& const_reference; 51546035553Spatrick static_assert((is_same<value_type, typename allocator_type::value_type>::value), 51646035553Spatrick "Invalid allocator::value_type"); 51746035553Spatrick 518*4bdff4beSrobert static_assert(is_same<allocator_type, __rebind_alloc<allocator_traits<allocator_type>, value_type> >::value, 519*4bdff4beSrobert "[allocator.requirements] states that rebinding an allocator to the same type should result in the " 520*4bdff4beSrobert "original allocator"); 521*4bdff4beSrobert 52246035553Spatrick private: 52346035553Spatrick typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table; 52446035553Spatrick 52546035553Spatrick __table __table_; 52646035553Spatrick 52746035553Spatrickpublic: 52846035553Spatrick typedef typename __table::pointer pointer; 52946035553Spatrick typedef typename __table::const_pointer const_pointer; 53046035553Spatrick typedef typename __table::size_type size_type; 53146035553Spatrick typedef typename __table::difference_type difference_type; 53246035553Spatrick 53346035553Spatrick typedef typename __table::const_iterator iterator; 53446035553Spatrick typedef typename __table::const_iterator const_iterator; 53546035553Spatrick typedef typename __table::const_local_iterator local_iterator; 53646035553Spatrick typedef typename __table::const_local_iterator const_local_iterator; 53746035553Spatrick 53846035553Spatrick#if _LIBCPP_STD_VER > 14 53946035553Spatrick typedef __set_node_handle<typename __table::__node, allocator_type> node_type; 54046035553Spatrick typedef __insert_return_type<iterator, node_type> insert_return_type; 54146035553Spatrick#endif 54246035553Spatrick 54346035553Spatrick template <class _Value2, class _Hash2, class _Pred2, class _Alloc2> 54446035553Spatrick friend class _LIBCPP_TEMPLATE_VIS unordered_set; 54546035553Spatrick template <class _Value2, class _Hash2, class _Pred2, class _Alloc2> 54646035553Spatrick friend class _LIBCPP_TEMPLATE_VIS unordered_multiset; 54746035553Spatrick 54846035553Spatrick _LIBCPP_INLINE_VISIBILITY 54946035553Spatrick unordered_set() 55046035553Spatrick _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) 55146035553Spatrick { 552*4bdff4beSrobert _VSTD::__debug_db_insert_c(this); 55346035553Spatrick } 55446035553Spatrick explicit unordered_set(size_type __n, const hasher& __hf = hasher(), 55546035553Spatrick const key_equal& __eql = key_equal()); 55646035553Spatrick#if _LIBCPP_STD_VER > 11 55746035553Spatrick inline _LIBCPP_INLINE_VISIBILITY 55846035553Spatrick unordered_set(size_type __n, const allocator_type& __a) 55946035553Spatrick : unordered_set(__n, hasher(), key_equal(), __a) {} 56046035553Spatrick inline _LIBCPP_INLINE_VISIBILITY 56146035553Spatrick unordered_set(size_type __n, const hasher& __hf, const allocator_type& __a) 56246035553Spatrick : unordered_set(__n, __hf, key_equal(), __a) {} 56346035553Spatrick#endif 56446035553Spatrick unordered_set(size_type __n, const hasher& __hf, const key_equal& __eql, 56546035553Spatrick const allocator_type& __a); 56646035553Spatrick template <class _InputIterator> 56746035553Spatrick unordered_set(_InputIterator __first, _InputIterator __last); 56846035553Spatrick template <class _InputIterator> 56946035553Spatrick unordered_set(_InputIterator __first, _InputIterator __last, 57046035553Spatrick size_type __n, const hasher& __hf = hasher(), 57146035553Spatrick const key_equal& __eql = key_equal()); 57246035553Spatrick template <class _InputIterator> 57346035553Spatrick unordered_set(_InputIterator __first, _InputIterator __last, 57446035553Spatrick size_type __n, const hasher& __hf, const key_equal& __eql, 57546035553Spatrick const allocator_type& __a); 57646035553Spatrick#if _LIBCPP_STD_VER > 11 57746035553Spatrick template <class _InputIterator> 57846035553Spatrick inline _LIBCPP_INLINE_VISIBILITY 57946035553Spatrick unordered_set(_InputIterator __first, _InputIterator __last, 58046035553Spatrick size_type __n, const allocator_type& __a) 58146035553Spatrick : unordered_set(__first, __last, __n, hasher(), key_equal(), __a) {} 58246035553Spatrick template <class _InputIterator> 58346035553Spatrick unordered_set(_InputIterator __first, _InputIterator __last, 58446035553Spatrick size_type __n, const hasher& __hf, const allocator_type& __a) 58546035553Spatrick : unordered_set(__first, __last, __n, __hf, key_equal(), __a) {} 58646035553Spatrick#endif 58746035553Spatrick _LIBCPP_INLINE_VISIBILITY 58846035553Spatrick explicit unordered_set(const allocator_type& __a); 58946035553Spatrick unordered_set(const unordered_set& __u); 59046035553Spatrick unordered_set(const unordered_set& __u, const allocator_type& __a); 59146035553Spatrick#ifndef _LIBCPP_CXX03_LANG 59246035553Spatrick _LIBCPP_INLINE_VISIBILITY 59346035553Spatrick unordered_set(unordered_set&& __u) 59446035553Spatrick _NOEXCEPT_(is_nothrow_move_constructible<__table>::value); 59546035553Spatrick unordered_set(unordered_set&& __u, const allocator_type& __a); 59646035553Spatrick unordered_set(initializer_list<value_type> __il); 59746035553Spatrick unordered_set(initializer_list<value_type> __il, size_type __n, 59846035553Spatrick const hasher& __hf = hasher(), 59946035553Spatrick const key_equal& __eql = key_equal()); 60046035553Spatrick unordered_set(initializer_list<value_type> __il, size_type __n, 60146035553Spatrick const hasher& __hf, const key_equal& __eql, 60246035553Spatrick const allocator_type& __a); 60346035553Spatrick#if _LIBCPP_STD_VER > 11 60446035553Spatrick inline _LIBCPP_INLINE_VISIBILITY 60546035553Spatrick unordered_set(initializer_list<value_type> __il, size_type __n, 60646035553Spatrick const allocator_type& __a) 60746035553Spatrick : unordered_set(__il, __n, hasher(), key_equal(), __a) {} 60846035553Spatrick inline _LIBCPP_INLINE_VISIBILITY 60946035553Spatrick unordered_set(initializer_list<value_type> __il, size_type __n, 61046035553Spatrick const hasher& __hf, const allocator_type& __a) 61146035553Spatrick : unordered_set(__il, __n, __hf, key_equal(), __a) {} 61246035553Spatrick#endif 61346035553Spatrick#endif // _LIBCPP_CXX03_LANG 61446035553Spatrick _LIBCPP_INLINE_VISIBILITY 61546035553Spatrick ~unordered_set() { 616*4bdff4beSrobert static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), ""); 61746035553Spatrick } 61846035553Spatrick 61946035553Spatrick _LIBCPP_INLINE_VISIBILITY 62046035553Spatrick unordered_set& operator=(const unordered_set& __u) 62146035553Spatrick { 62246035553Spatrick __table_ = __u.__table_; 62346035553Spatrick return *this; 62446035553Spatrick } 62546035553Spatrick#ifndef _LIBCPP_CXX03_LANG 62646035553Spatrick _LIBCPP_INLINE_VISIBILITY 62746035553Spatrick unordered_set& operator=(unordered_set&& __u) 62846035553Spatrick _NOEXCEPT_(is_nothrow_move_assignable<__table>::value); 62946035553Spatrick _LIBCPP_INLINE_VISIBILITY 63046035553Spatrick unordered_set& operator=(initializer_list<value_type> __il); 63146035553Spatrick#endif // _LIBCPP_CXX03_LANG 63246035553Spatrick 63346035553Spatrick _LIBCPP_INLINE_VISIBILITY 63446035553Spatrick allocator_type get_allocator() const _NOEXCEPT 63546035553Spatrick {return allocator_type(__table_.__node_alloc());} 63646035553Spatrick 63746035553Spatrick _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY 63846035553Spatrick bool empty() const _NOEXCEPT {return __table_.size() == 0;} 63946035553Spatrick _LIBCPP_INLINE_VISIBILITY 64046035553Spatrick size_type size() const _NOEXCEPT {return __table_.size();} 64146035553Spatrick _LIBCPP_INLINE_VISIBILITY 64246035553Spatrick size_type max_size() const _NOEXCEPT {return __table_.max_size();} 64346035553Spatrick 64446035553Spatrick _LIBCPP_INLINE_VISIBILITY 64546035553Spatrick iterator begin() _NOEXCEPT {return __table_.begin();} 64646035553Spatrick _LIBCPP_INLINE_VISIBILITY 64746035553Spatrick iterator end() _NOEXCEPT {return __table_.end();} 64846035553Spatrick _LIBCPP_INLINE_VISIBILITY 64946035553Spatrick const_iterator begin() const _NOEXCEPT {return __table_.begin();} 65046035553Spatrick _LIBCPP_INLINE_VISIBILITY 65146035553Spatrick const_iterator end() const _NOEXCEPT {return __table_.end();} 65246035553Spatrick _LIBCPP_INLINE_VISIBILITY 65346035553Spatrick const_iterator cbegin() const _NOEXCEPT {return __table_.begin();} 65446035553Spatrick _LIBCPP_INLINE_VISIBILITY 65546035553Spatrick const_iterator cend() const _NOEXCEPT {return __table_.end();} 65646035553Spatrick 65746035553Spatrick#ifndef _LIBCPP_CXX03_LANG 65846035553Spatrick template <class... _Args> 65946035553Spatrick _LIBCPP_INLINE_VISIBILITY 66046035553Spatrick pair<iterator, bool> emplace(_Args&&... __args) 66146035553Spatrick {return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...);} 66246035553Spatrick template <class... _Args> 66346035553Spatrick _LIBCPP_INLINE_VISIBILITY 664*4bdff4beSrobert iterator emplace_hint(const_iterator __p, _Args&&... __args) { 665*4bdff4beSrobert _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__p)) == this, 66646035553Spatrick "unordered_set::emplace_hint(const_iterator, args...) called with an iterator not" 66746035553Spatrick " referring to this unordered_set"); 668*4bdff4beSrobert (void)__p; 669*4bdff4beSrobert return __table_.__emplace_unique(std::forward<_Args>(__args)...).first; 67046035553Spatrick } 67146035553Spatrick 67246035553Spatrick _LIBCPP_INLINE_VISIBILITY 67346035553Spatrick pair<iterator, bool> insert(value_type&& __x) 67446035553Spatrick {return __table_.__insert_unique(_VSTD::move(__x));} 67546035553Spatrick _LIBCPP_INLINE_VISIBILITY 676*4bdff4beSrobert iterator insert(const_iterator __p, value_type&& __x) { 677*4bdff4beSrobert _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__p)) == this, 67846035553Spatrick "unordered_set::insert(const_iterator, value_type&&) called with an iterator not" 67946035553Spatrick " referring to this unordered_set"); 680*4bdff4beSrobert (void)__p; 681*4bdff4beSrobert return insert(std::move(__x)).first; 68246035553Spatrick } 683*4bdff4beSrobert 68446035553Spatrick _LIBCPP_INLINE_VISIBILITY 68546035553Spatrick void insert(initializer_list<value_type> __il) 68646035553Spatrick {insert(__il.begin(), __il.end());} 68746035553Spatrick#endif // _LIBCPP_CXX03_LANG 68846035553Spatrick _LIBCPP_INLINE_VISIBILITY 68946035553Spatrick pair<iterator, bool> insert(const value_type& __x) 69046035553Spatrick {return __table_.__insert_unique(__x);} 69146035553Spatrick 69246035553Spatrick _LIBCPP_INLINE_VISIBILITY 693*4bdff4beSrobert iterator insert(const_iterator __p, const value_type& __x) { 694*4bdff4beSrobert _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__p)) == this, 69546035553Spatrick "unordered_set::insert(const_iterator, const value_type&) called with an iterator not" 69646035553Spatrick " referring to this unordered_set"); 697*4bdff4beSrobert (void)__p; 69846035553Spatrick return insert(__x).first; 69946035553Spatrick } 70046035553Spatrick template <class _InputIterator> 70146035553Spatrick _LIBCPP_INLINE_VISIBILITY 70246035553Spatrick void insert(_InputIterator __first, _InputIterator __last); 70346035553Spatrick 70446035553Spatrick _LIBCPP_INLINE_VISIBILITY 70546035553Spatrick iterator erase(const_iterator __p) {return __table_.erase(__p);} 70646035553Spatrick _LIBCPP_INLINE_VISIBILITY 70746035553Spatrick size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);} 70846035553Spatrick _LIBCPP_INLINE_VISIBILITY 70946035553Spatrick iterator erase(const_iterator __first, const_iterator __last) 71046035553Spatrick {return __table_.erase(__first, __last);} 71146035553Spatrick _LIBCPP_INLINE_VISIBILITY 71246035553Spatrick void clear() _NOEXCEPT {__table_.clear();} 71346035553Spatrick 71446035553Spatrick#if _LIBCPP_STD_VER > 14 71546035553Spatrick _LIBCPP_INLINE_VISIBILITY 71646035553Spatrick insert_return_type insert(node_type&& __nh) 71746035553Spatrick { 71846035553Spatrick _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), 71946035553Spatrick "node_type with incompatible allocator passed to unordered_set::insert()"); 72046035553Spatrick return __table_.template __node_handle_insert_unique< 72146035553Spatrick node_type, insert_return_type>(_VSTD::move(__nh)); 72246035553Spatrick } 72346035553Spatrick _LIBCPP_INLINE_VISIBILITY 72446035553Spatrick iterator insert(const_iterator __h, node_type&& __nh) 72546035553Spatrick { 72646035553Spatrick _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), 72746035553Spatrick "node_type with incompatible allocator passed to unordered_set::insert()"); 72846035553Spatrick return __table_.template __node_handle_insert_unique<node_type>( 72946035553Spatrick __h, _VSTD::move(__nh)); 73046035553Spatrick } 73146035553Spatrick _LIBCPP_INLINE_VISIBILITY 73246035553Spatrick node_type extract(key_type const& __key) 73346035553Spatrick { 73446035553Spatrick return __table_.template __node_handle_extract<node_type>(__key); 73546035553Spatrick } 73646035553Spatrick _LIBCPP_INLINE_VISIBILITY 73746035553Spatrick node_type extract(const_iterator __it) 73846035553Spatrick { 73946035553Spatrick return __table_.template __node_handle_extract<node_type>(__it); 74046035553Spatrick } 74146035553Spatrick 74246035553Spatrick template<class _H2, class _P2> 74346035553Spatrick _LIBCPP_INLINE_VISIBILITY 74446035553Spatrick void merge(unordered_set<key_type, _H2, _P2, allocator_type>& __source) 74546035553Spatrick { 74646035553Spatrick _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 74746035553Spatrick "merging container with incompatible allocator"); 74846035553Spatrick __table_.__node_handle_merge_unique(__source.__table_); 74946035553Spatrick } 75046035553Spatrick template<class _H2, class _P2> 75146035553Spatrick _LIBCPP_INLINE_VISIBILITY 75246035553Spatrick void merge(unordered_set<key_type, _H2, _P2, allocator_type>&& __source) 75346035553Spatrick { 75446035553Spatrick _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 75546035553Spatrick "merging container with incompatible allocator"); 75646035553Spatrick __table_.__node_handle_merge_unique(__source.__table_); 75746035553Spatrick } 75846035553Spatrick template<class _H2, class _P2> 75946035553Spatrick _LIBCPP_INLINE_VISIBILITY 76046035553Spatrick void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>& __source) 76146035553Spatrick { 76246035553Spatrick _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 76346035553Spatrick "merging container with incompatible allocator"); 76446035553Spatrick __table_.__node_handle_merge_unique(__source.__table_); 76546035553Spatrick } 76646035553Spatrick template<class _H2, class _P2> 76746035553Spatrick _LIBCPP_INLINE_VISIBILITY 76846035553Spatrick void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>&& __source) 76946035553Spatrick { 77046035553Spatrick _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 77146035553Spatrick "merging container with incompatible allocator"); 77246035553Spatrick __table_.__node_handle_merge_unique(__source.__table_); 77346035553Spatrick } 77446035553Spatrick#endif 77546035553Spatrick 77646035553Spatrick _LIBCPP_INLINE_VISIBILITY 77746035553Spatrick void swap(unordered_set& __u) 77846035553Spatrick _NOEXCEPT_(__is_nothrow_swappable<__table>::value) 77946035553Spatrick {__table_.swap(__u.__table_);} 78046035553Spatrick 78146035553Spatrick _LIBCPP_INLINE_VISIBILITY 78246035553Spatrick hasher hash_function() const {return __table_.hash_function();} 78346035553Spatrick _LIBCPP_INLINE_VISIBILITY 78446035553Spatrick key_equal key_eq() const {return __table_.key_eq();} 78546035553Spatrick 78646035553Spatrick _LIBCPP_INLINE_VISIBILITY 78746035553Spatrick iterator find(const key_type& __k) {return __table_.find(__k);} 78846035553Spatrick _LIBCPP_INLINE_VISIBILITY 78946035553Spatrick const_iterator find(const key_type& __k) const {return __table_.find(__k);} 79076d0caaeSpatrick#if _LIBCPP_STD_VER > 17 791*4bdff4beSrobert template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 79276d0caaeSpatrick _LIBCPP_INLINE_VISIBILITY 793*4bdff4beSrobert iterator find(const _K2& __k) {return __table_.find(__k);} 794*4bdff4beSrobert template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 79576d0caaeSpatrick _LIBCPP_INLINE_VISIBILITY 796*4bdff4beSrobert const_iterator find(const _K2& __k) const {return __table_.find(__k);} 79776d0caaeSpatrick#endif // _LIBCPP_STD_VER > 17 798*4bdff4beSrobert 79946035553Spatrick _LIBCPP_INLINE_VISIBILITY 80046035553Spatrick size_type count(const key_type& __k) const {return __table_.__count_unique(__k);} 80146035553Spatrick#if _LIBCPP_STD_VER > 17 802*4bdff4beSrobert template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 80376d0caaeSpatrick _LIBCPP_INLINE_VISIBILITY 804*4bdff4beSrobert size_type count(const _K2& __k) const {return __table_.__count_unique(__k);} 80576d0caaeSpatrick#endif // _LIBCPP_STD_VER > 17 806*4bdff4beSrobert 80776d0caaeSpatrick#if _LIBCPP_STD_VER > 17 80846035553Spatrick _LIBCPP_INLINE_VISIBILITY 80946035553Spatrick bool contains(const key_type& __k) const {return find(__k) != end();} 81076d0caaeSpatrick 811*4bdff4beSrobert template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 81276d0caaeSpatrick _LIBCPP_INLINE_VISIBILITY 813*4bdff4beSrobert bool contains(const _K2& __k) const {return find(__k) != end();} 81446035553Spatrick#endif // _LIBCPP_STD_VER > 17 815*4bdff4beSrobert 81646035553Spatrick _LIBCPP_INLINE_VISIBILITY 81746035553Spatrick pair<iterator, iterator> equal_range(const key_type& __k) 81846035553Spatrick {return __table_.__equal_range_unique(__k);} 81946035553Spatrick _LIBCPP_INLINE_VISIBILITY 82046035553Spatrick pair<const_iterator, const_iterator> equal_range(const key_type& __k) const 82146035553Spatrick {return __table_.__equal_range_unique(__k);} 82276d0caaeSpatrick#if _LIBCPP_STD_VER > 17 823*4bdff4beSrobert template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 82476d0caaeSpatrick _LIBCPP_INLINE_VISIBILITY 825*4bdff4beSrobert pair<iterator, iterator> equal_range(const _K2& __k) 826*4bdff4beSrobert {return __table_.__equal_range_unique(__k);} 827*4bdff4beSrobert template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 82876d0caaeSpatrick _LIBCPP_INLINE_VISIBILITY 829*4bdff4beSrobert pair<const_iterator, const_iterator> equal_range(const _K2& __k) const 830*4bdff4beSrobert {return __table_.__equal_range_unique(__k);} 83176d0caaeSpatrick#endif // _LIBCPP_STD_VER > 17 83246035553Spatrick 83346035553Spatrick _LIBCPP_INLINE_VISIBILITY 83446035553Spatrick size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();} 83546035553Spatrick _LIBCPP_INLINE_VISIBILITY 83646035553Spatrick size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();} 83746035553Spatrick 83846035553Spatrick _LIBCPP_INLINE_VISIBILITY 83946035553Spatrick size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);} 84046035553Spatrick _LIBCPP_INLINE_VISIBILITY 84146035553Spatrick size_type bucket(const key_type& __k) const {return __table_.bucket(__k);} 84246035553Spatrick 84346035553Spatrick _LIBCPP_INLINE_VISIBILITY 84446035553Spatrick local_iterator begin(size_type __n) {return __table_.begin(__n);} 84546035553Spatrick _LIBCPP_INLINE_VISIBILITY 84646035553Spatrick local_iterator end(size_type __n) {return __table_.end(__n);} 84746035553Spatrick _LIBCPP_INLINE_VISIBILITY 84846035553Spatrick const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);} 84946035553Spatrick _LIBCPP_INLINE_VISIBILITY 85046035553Spatrick const_local_iterator end(size_type __n) const {return __table_.cend(__n);} 85146035553Spatrick _LIBCPP_INLINE_VISIBILITY 85246035553Spatrick const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);} 85346035553Spatrick _LIBCPP_INLINE_VISIBILITY 85446035553Spatrick const_local_iterator cend(size_type __n) const {return __table_.cend(__n);} 85546035553Spatrick 85646035553Spatrick _LIBCPP_INLINE_VISIBILITY 85746035553Spatrick float load_factor() const _NOEXCEPT {return __table_.load_factor();} 85846035553Spatrick _LIBCPP_INLINE_VISIBILITY 85946035553Spatrick float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();} 86046035553Spatrick _LIBCPP_INLINE_VISIBILITY 86146035553Spatrick void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);} 86246035553Spatrick _LIBCPP_INLINE_VISIBILITY 863*4bdff4beSrobert void rehash(size_type __n) {__table_.__rehash_unique(__n);} 86446035553Spatrick _LIBCPP_INLINE_VISIBILITY 865*4bdff4beSrobert void reserve(size_type __n) {__table_.__reserve_unique(__n);} 86646035553Spatrick 867*4bdff4beSrobert#ifdef _LIBCPP_ENABLE_DEBUG_MODE 86846035553Spatrick 86946035553Spatrick bool __dereferenceable(const const_iterator* __i) const 87046035553Spatrick {return __table_.__dereferenceable(__i);} 87146035553Spatrick bool __decrementable(const const_iterator* __i) const 87246035553Spatrick {return __table_.__decrementable(__i);} 87346035553Spatrick bool __addable(const const_iterator* __i, ptrdiff_t __n) const 87446035553Spatrick {return __table_.__addable(__i, __n);} 87546035553Spatrick bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const 87646035553Spatrick {return __table_.__addable(__i, __n);} 87746035553Spatrick 878*4bdff4beSrobert#endif // _LIBCPP_ENABLE_DEBUG_MODE 87946035553Spatrick 88046035553Spatrick}; 88146035553Spatrick 882*4bdff4beSrobert#if _LIBCPP_STD_VER >= 17 88346035553Spatricktemplate<class _InputIterator, 88446035553Spatrick class _Hash = hash<__iter_value_type<_InputIterator>>, 88546035553Spatrick class _Pred = equal_to<__iter_value_type<_InputIterator>>, 88646035553Spatrick class _Allocator = allocator<__iter_value_type<_InputIterator>>, 887*4bdff4beSrobert class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, 888*4bdff4beSrobert class = enable_if_t<!__is_allocator<_Hash>::value>, 889*4bdff4beSrobert class = enable_if_t<!is_integral<_Hash>::value>, 890*4bdff4beSrobert class = enable_if_t<!__is_allocator<_Pred>::value>, 891*4bdff4beSrobert class = enable_if_t<__is_allocator<_Allocator>::value>> 89246035553Spatrickunordered_set(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0, 89346035553Spatrick _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) 89446035553Spatrick -> unordered_set<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>; 89546035553Spatrick 89646035553Spatricktemplate<class _Tp, class _Hash = hash<_Tp>, 89746035553Spatrick class _Pred = equal_to<_Tp>, 89846035553Spatrick class _Allocator = allocator<_Tp>, 899*4bdff4beSrobert class = enable_if_t<!__is_allocator<_Hash>::value>, 900*4bdff4beSrobert class = enable_if_t<!is_integral<_Hash>::value>, 901*4bdff4beSrobert class = enable_if_t<!__is_allocator<_Pred>::value>, 902*4bdff4beSrobert class = enable_if_t<__is_allocator<_Allocator>::value>> 90346035553Spatrickunordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type = 0, 90446035553Spatrick _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) 90546035553Spatrick -> unordered_set<_Tp, _Hash, _Pred, _Allocator>; 90646035553Spatrick 90746035553Spatricktemplate<class _InputIterator, class _Allocator, 908*4bdff4beSrobert class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, 909*4bdff4beSrobert class = enable_if_t<__is_allocator<_Allocator>::value>> 91046035553Spatrickunordered_set(_InputIterator, _InputIterator, 91146035553Spatrick typename allocator_traits<_Allocator>::size_type, _Allocator) 91246035553Spatrick -> unordered_set<__iter_value_type<_InputIterator>, 91346035553Spatrick hash<__iter_value_type<_InputIterator>>, 91446035553Spatrick equal_to<__iter_value_type<_InputIterator>>, 91546035553Spatrick _Allocator>; 91646035553Spatrick 91746035553Spatricktemplate<class _InputIterator, class _Hash, class _Allocator, 918*4bdff4beSrobert class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, 919*4bdff4beSrobert class = enable_if_t<!__is_allocator<_Hash>::value>, 920*4bdff4beSrobert class = enable_if_t<!is_integral<_Hash>::value>, 921*4bdff4beSrobert class = enable_if_t<__is_allocator<_Allocator>::value>> 92246035553Spatrickunordered_set(_InputIterator, _InputIterator, 92346035553Spatrick typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator) 92446035553Spatrick -> unordered_set<__iter_value_type<_InputIterator>, _Hash, 92546035553Spatrick equal_to<__iter_value_type<_InputIterator>>, 92646035553Spatrick _Allocator>; 92746035553Spatrick 92846035553Spatricktemplate<class _Tp, class _Allocator, 929*4bdff4beSrobert class = enable_if_t<__is_allocator<_Allocator>::value>> 93046035553Spatrickunordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Allocator) 93146035553Spatrick -> unordered_set<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>; 93246035553Spatrick 93346035553Spatricktemplate<class _Tp, class _Hash, class _Allocator, 934*4bdff4beSrobert class = enable_if_t<!__is_allocator<_Hash>::value>, 935*4bdff4beSrobert class = enable_if_t<!is_integral<_Hash>::value>, 936*4bdff4beSrobert class = enable_if_t<__is_allocator<_Allocator>::value>> 93746035553Spatrickunordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator) 93846035553Spatrick -> unordered_set<_Tp, _Hash, equal_to<_Tp>, _Allocator>; 93946035553Spatrick#endif 94046035553Spatrick 94146035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 94246035553Spatrickunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n, 94346035553Spatrick const hasher& __hf, const key_equal& __eql) 94446035553Spatrick : __table_(__hf, __eql) 94546035553Spatrick{ 946*4bdff4beSrobert _VSTD::__debug_db_insert_c(this); 947*4bdff4beSrobert __table_.__rehash_unique(__n); 94846035553Spatrick} 94946035553Spatrick 95046035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 95146035553Spatrickunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n, 95246035553Spatrick const hasher& __hf, const key_equal& __eql, const allocator_type& __a) 95346035553Spatrick : __table_(__hf, __eql, __a) 95446035553Spatrick{ 955*4bdff4beSrobert _VSTD::__debug_db_insert_c(this); 956*4bdff4beSrobert __table_.__rehash_unique(__n); 95746035553Spatrick} 95846035553Spatrick 95946035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 96046035553Spatricktemplate <class _InputIterator> 96146035553Spatrickunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 96246035553Spatrick _InputIterator __first, _InputIterator __last) 96346035553Spatrick{ 964*4bdff4beSrobert _VSTD::__debug_db_insert_c(this); 96546035553Spatrick insert(__first, __last); 96646035553Spatrick} 96746035553Spatrick 96846035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 96946035553Spatricktemplate <class _InputIterator> 97046035553Spatrickunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 97146035553Spatrick _InputIterator __first, _InputIterator __last, size_type __n, 97246035553Spatrick const hasher& __hf, const key_equal& __eql) 97346035553Spatrick : __table_(__hf, __eql) 97446035553Spatrick{ 975*4bdff4beSrobert _VSTD::__debug_db_insert_c(this); 976*4bdff4beSrobert __table_.__rehash_unique(__n); 97746035553Spatrick insert(__first, __last); 97846035553Spatrick} 97946035553Spatrick 98046035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 98146035553Spatricktemplate <class _InputIterator> 98246035553Spatrickunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 98346035553Spatrick _InputIterator __first, _InputIterator __last, size_type __n, 98446035553Spatrick const hasher& __hf, const key_equal& __eql, const allocator_type& __a) 98546035553Spatrick : __table_(__hf, __eql, __a) 98646035553Spatrick{ 987*4bdff4beSrobert _VSTD::__debug_db_insert_c(this); 988*4bdff4beSrobert __table_.__rehash_unique(__n); 98946035553Spatrick insert(__first, __last); 99046035553Spatrick} 99146035553Spatrick 99246035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 99346035553Spatrickinline 99446035553Spatrickunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 99546035553Spatrick const allocator_type& __a) 99646035553Spatrick : __table_(__a) 99746035553Spatrick{ 998*4bdff4beSrobert _VSTD::__debug_db_insert_c(this); 99946035553Spatrick} 100046035553Spatrick 100146035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 100246035553Spatrickunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 100346035553Spatrick const unordered_set& __u) 100446035553Spatrick : __table_(__u.__table_) 100546035553Spatrick{ 1006*4bdff4beSrobert _VSTD::__debug_db_insert_c(this); 1007*4bdff4beSrobert __table_.__rehash_unique(__u.bucket_count()); 100846035553Spatrick insert(__u.begin(), __u.end()); 100946035553Spatrick} 101046035553Spatrick 101146035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 101246035553Spatrickunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 101346035553Spatrick const unordered_set& __u, const allocator_type& __a) 101446035553Spatrick : __table_(__u.__table_, __a) 101546035553Spatrick{ 1016*4bdff4beSrobert _VSTD::__debug_db_insert_c(this); 1017*4bdff4beSrobert __table_.__rehash_unique(__u.bucket_count()); 101846035553Spatrick insert(__u.begin(), __u.end()); 101946035553Spatrick} 102046035553Spatrick 102146035553Spatrick#ifndef _LIBCPP_CXX03_LANG 102246035553Spatrick 102346035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 102446035553Spatrickinline 102546035553Spatrickunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 102646035553Spatrick unordered_set&& __u) 102746035553Spatrick _NOEXCEPT_(is_nothrow_move_constructible<__table>::value) 102846035553Spatrick : __table_(_VSTD::move(__u.__table_)) 102946035553Spatrick{ 1030*4bdff4beSrobert _VSTD::__debug_db_insert_c(this); 1031*4bdff4beSrobert std::__debug_db_swap(this, std::addressof(__u)); 103246035553Spatrick} 103346035553Spatrick 103446035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 103546035553Spatrickunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 103646035553Spatrick unordered_set&& __u, const allocator_type& __a) 103746035553Spatrick : __table_(_VSTD::move(__u.__table_), __a) 103846035553Spatrick{ 1039*4bdff4beSrobert _VSTD::__debug_db_insert_c(this); 104046035553Spatrick if (__a != __u.get_allocator()) 104146035553Spatrick { 104246035553Spatrick iterator __i = __u.begin(); 104346035553Spatrick while (__u.size() != 0) 104446035553Spatrick __table_.__insert_unique(_VSTD::move(__u.__table_.remove(__i++)->__value_)); 104546035553Spatrick } 104646035553Spatrick else 1047*4bdff4beSrobert std::__debug_db_swap(this, std::addressof(__u)); 104846035553Spatrick} 104946035553Spatrick 105046035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 105146035553Spatrickunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 105246035553Spatrick initializer_list<value_type> __il) 105346035553Spatrick{ 1054*4bdff4beSrobert _VSTD::__debug_db_insert_c(this); 105546035553Spatrick insert(__il.begin(), __il.end()); 105646035553Spatrick} 105746035553Spatrick 105846035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 105946035553Spatrickunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 106046035553Spatrick initializer_list<value_type> __il, size_type __n, const hasher& __hf, 106146035553Spatrick const key_equal& __eql) 106246035553Spatrick : __table_(__hf, __eql) 106346035553Spatrick{ 1064*4bdff4beSrobert _VSTD::__debug_db_insert_c(this); 1065*4bdff4beSrobert __table_.__rehash_unique(__n); 106646035553Spatrick insert(__il.begin(), __il.end()); 106746035553Spatrick} 106846035553Spatrick 106946035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 107046035553Spatrickunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 107146035553Spatrick initializer_list<value_type> __il, size_type __n, const hasher& __hf, 107246035553Spatrick const key_equal& __eql, const allocator_type& __a) 107346035553Spatrick : __table_(__hf, __eql, __a) 107446035553Spatrick{ 1075*4bdff4beSrobert _VSTD::__debug_db_insert_c(this); 1076*4bdff4beSrobert __table_.__rehash_unique(__n); 107746035553Spatrick insert(__il.begin(), __il.end()); 107846035553Spatrick} 107946035553Spatrick 108046035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 108146035553Spatrickinline 108246035553Spatrickunordered_set<_Value, _Hash, _Pred, _Alloc>& 108346035553Spatrickunordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(unordered_set&& __u) 108446035553Spatrick _NOEXCEPT_(is_nothrow_move_assignable<__table>::value) 108546035553Spatrick{ 108646035553Spatrick __table_ = _VSTD::move(__u.__table_); 108746035553Spatrick return *this; 108846035553Spatrick} 108946035553Spatrick 109046035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 109146035553Spatrickinline 109246035553Spatrickunordered_set<_Value, _Hash, _Pred, _Alloc>& 109346035553Spatrickunordered_set<_Value, _Hash, _Pred, _Alloc>::operator=( 109446035553Spatrick initializer_list<value_type> __il) 109546035553Spatrick{ 109646035553Spatrick __table_.__assign_unique(__il.begin(), __il.end()); 109746035553Spatrick return *this; 109846035553Spatrick} 109946035553Spatrick 110046035553Spatrick#endif // _LIBCPP_CXX03_LANG 110146035553Spatrick 110246035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 110346035553Spatricktemplate <class _InputIterator> 110446035553Spatrickinline 110546035553Spatrickvoid 110646035553Spatrickunordered_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, 110746035553Spatrick _InputIterator __last) 110846035553Spatrick{ 110946035553Spatrick for (; __first != __last; ++__first) 111046035553Spatrick __table_.__insert_unique(*__first); 111146035553Spatrick} 111246035553Spatrick 111346035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 111446035553Spatrickinline _LIBCPP_INLINE_VISIBILITY 111546035553Spatrickvoid 111646035553Spatrickswap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, 111746035553Spatrick unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) 111846035553Spatrick _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) 111946035553Spatrick{ 112046035553Spatrick __x.swap(__y); 112146035553Spatrick} 112246035553Spatrick 112346035553Spatrick#if _LIBCPP_STD_VER > 17 1124037e7968Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc, 1125037e7968Spatrick class _Predicate> 112646035553Spatrickinline _LIBCPP_INLINE_VISIBILITY 1127037e7968Spatrick typename unordered_set<_Value, _Hash, _Pred, _Alloc>::size_type 1128037e7968Spatrick erase_if(unordered_set<_Value, _Hash, _Pred, _Alloc>& __c, 1129037e7968Spatrick _Predicate __pred) { 113076d0caaeSpatrick return _VSTD::__libcpp_erase_if_container(__c, __pred); 1131037e7968Spatrick} 113246035553Spatrick#endif 113346035553Spatrick 113446035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 1135*4bdff4beSrobert_LIBCPP_HIDE_FROM_ABI bool 113646035553Spatrickoperator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, 113746035553Spatrick const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) 113846035553Spatrick{ 113946035553Spatrick if (__x.size() != __y.size()) 114046035553Spatrick return false; 114146035553Spatrick typedef typename unordered_set<_Value, _Hash, _Pred, _Alloc>::const_iterator 114246035553Spatrick const_iterator; 114346035553Spatrick for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end(); 114446035553Spatrick __i != __ex; ++__i) 114546035553Spatrick { 114646035553Spatrick const_iterator __j = __y.find(*__i); 114746035553Spatrick if (__j == __ey || !(*__i == *__j)) 114846035553Spatrick return false; 114946035553Spatrick } 115046035553Spatrick return true; 115146035553Spatrick} 115246035553Spatrick 115346035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 115446035553Spatrickinline _LIBCPP_INLINE_VISIBILITY 115546035553Spatrickbool 115646035553Spatrickoperator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, 115746035553Spatrick const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) 115846035553Spatrick{ 115946035553Spatrick return !(__x == __y); 116046035553Spatrick} 116146035553Spatrick 116246035553Spatricktemplate <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>, 116346035553Spatrick class _Alloc = allocator<_Value> > 116446035553Spatrickclass _LIBCPP_TEMPLATE_VIS unordered_multiset 116546035553Spatrick{ 116646035553Spatrickpublic: 116746035553Spatrick // types 116846035553Spatrick typedef _Value key_type; 116946035553Spatrick typedef key_type value_type; 1170*4bdff4beSrobert typedef __type_identity_t<_Hash> hasher; 1171*4bdff4beSrobert typedef __type_identity_t<_Pred> key_equal; 1172*4bdff4beSrobert typedef __type_identity_t<_Alloc> allocator_type; 117346035553Spatrick typedef value_type& reference; 117446035553Spatrick typedef const value_type& const_reference; 117546035553Spatrick static_assert((is_same<value_type, typename allocator_type::value_type>::value), 117646035553Spatrick "Invalid allocator::value_type"); 117746035553Spatrick 117846035553Spatrickprivate: 117946035553Spatrick typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table; 118046035553Spatrick 118146035553Spatrick __table __table_; 118246035553Spatrick 118346035553Spatrickpublic: 118446035553Spatrick typedef typename __table::pointer pointer; 118546035553Spatrick typedef typename __table::const_pointer const_pointer; 118646035553Spatrick typedef typename __table::size_type size_type; 118746035553Spatrick typedef typename __table::difference_type difference_type; 118846035553Spatrick 118946035553Spatrick typedef typename __table::const_iterator iterator; 119046035553Spatrick typedef typename __table::const_iterator const_iterator; 119146035553Spatrick typedef typename __table::const_local_iterator local_iterator; 119246035553Spatrick typedef typename __table::const_local_iterator const_local_iterator; 119346035553Spatrick 119446035553Spatrick#if _LIBCPP_STD_VER > 14 119546035553Spatrick typedef __set_node_handle<typename __table::__node, allocator_type> node_type; 119646035553Spatrick#endif 119746035553Spatrick 119846035553Spatrick template <class _Value2, class _Hash2, class _Pred2, class _Alloc2> 119946035553Spatrick friend class _LIBCPP_TEMPLATE_VIS unordered_set; 120046035553Spatrick template <class _Value2, class _Hash2, class _Pred2, class _Alloc2> 120146035553Spatrick friend class _LIBCPP_TEMPLATE_VIS unordered_multiset; 120246035553Spatrick 120346035553Spatrick _LIBCPP_INLINE_VISIBILITY 120446035553Spatrick unordered_multiset() 120546035553Spatrick _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) 120646035553Spatrick { 1207*4bdff4beSrobert _VSTD::__debug_db_insert_c(this); 120846035553Spatrick } 120946035553Spatrick explicit unordered_multiset(size_type __n, const hasher& __hf = hasher(), 121046035553Spatrick const key_equal& __eql = key_equal()); 121146035553Spatrick unordered_multiset(size_type __n, const hasher& __hf, 121246035553Spatrick const key_equal& __eql, const allocator_type& __a); 121346035553Spatrick#if _LIBCPP_STD_VER > 11 121446035553Spatrick inline _LIBCPP_INLINE_VISIBILITY 121546035553Spatrick unordered_multiset(size_type __n, const allocator_type& __a) 121646035553Spatrick : unordered_multiset(__n, hasher(), key_equal(), __a) {} 121746035553Spatrick inline _LIBCPP_INLINE_VISIBILITY 121846035553Spatrick unordered_multiset(size_type __n, const hasher& __hf, const allocator_type& __a) 121946035553Spatrick : unordered_multiset(__n, __hf, key_equal(), __a) {} 122046035553Spatrick#endif 122146035553Spatrick template <class _InputIterator> 122246035553Spatrick unordered_multiset(_InputIterator __first, _InputIterator __last); 122346035553Spatrick template <class _InputIterator> 122446035553Spatrick unordered_multiset(_InputIterator __first, _InputIterator __last, 122546035553Spatrick size_type __n, const hasher& __hf = hasher(), 122646035553Spatrick const key_equal& __eql = key_equal()); 122746035553Spatrick template <class _InputIterator> 122846035553Spatrick unordered_multiset(_InputIterator __first, _InputIterator __last, 122946035553Spatrick size_type __n , const hasher& __hf, 123046035553Spatrick const key_equal& __eql, const allocator_type& __a); 123146035553Spatrick#if _LIBCPP_STD_VER > 11 123246035553Spatrick template <class _InputIterator> 123346035553Spatrick inline _LIBCPP_INLINE_VISIBILITY 123446035553Spatrick unordered_multiset(_InputIterator __first, _InputIterator __last, 123546035553Spatrick size_type __n, const allocator_type& __a) 123646035553Spatrick : unordered_multiset(__first, __last, __n, hasher(), key_equal(), __a) {} 123746035553Spatrick template <class _InputIterator> 123846035553Spatrick inline _LIBCPP_INLINE_VISIBILITY 123946035553Spatrick unordered_multiset(_InputIterator __first, _InputIterator __last, 124046035553Spatrick size_type __n, const hasher& __hf, const allocator_type& __a) 124146035553Spatrick : unordered_multiset(__first, __last, __n, __hf, key_equal(), __a) {} 124246035553Spatrick#endif 124346035553Spatrick _LIBCPP_INLINE_VISIBILITY 124446035553Spatrick explicit unordered_multiset(const allocator_type& __a); 124546035553Spatrick unordered_multiset(const unordered_multiset& __u); 124646035553Spatrick unordered_multiset(const unordered_multiset& __u, const allocator_type& __a); 124746035553Spatrick#ifndef _LIBCPP_CXX03_LANG 124846035553Spatrick _LIBCPP_INLINE_VISIBILITY 124946035553Spatrick unordered_multiset(unordered_multiset&& __u) 125046035553Spatrick _NOEXCEPT_(is_nothrow_move_constructible<__table>::value); 125146035553Spatrick unordered_multiset(unordered_multiset&& __u, const allocator_type& __a); 125246035553Spatrick unordered_multiset(initializer_list<value_type> __il); 125346035553Spatrick unordered_multiset(initializer_list<value_type> __il, size_type __n, 125446035553Spatrick const hasher& __hf = hasher(), 125546035553Spatrick const key_equal& __eql = key_equal()); 125646035553Spatrick unordered_multiset(initializer_list<value_type> __il, size_type __n, 125746035553Spatrick const hasher& __hf, const key_equal& __eql, 125846035553Spatrick const allocator_type& __a); 125946035553Spatrick#if _LIBCPP_STD_VER > 11 126046035553Spatrick inline _LIBCPP_INLINE_VISIBILITY 126146035553Spatrick unordered_multiset(initializer_list<value_type> __il, size_type __n, const allocator_type& __a) 126246035553Spatrick : unordered_multiset(__il, __n, hasher(), key_equal(), __a) {} 126346035553Spatrick inline _LIBCPP_INLINE_VISIBILITY 126446035553Spatrick unordered_multiset(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a) 126546035553Spatrick : unordered_multiset(__il, __n, __hf, key_equal(), __a) {} 126646035553Spatrick#endif 126746035553Spatrick#endif // _LIBCPP_CXX03_LANG 126846035553Spatrick _LIBCPP_INLINE_VISIBILITY 126946035553Spatrick ~unordered_multiset() { 1270*4bdff4beSrobert static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), ""); 127146035553Spatrick } 127246035553Spatrick 127346035553Spatrick _LIBCPP_INLINE_VISIBILITY 127446035553Spatrick unordered_multiset& operator=(const unordered_multiset& __u) 127546035553Spatrick { 127646035553Spatrick __table_ = __u.__table_; 127746035553Spatrick return *this; 127846035553Spatrick } 127946035553Spatrick#ifndef _LIBCPP_CXX03_LANG 128046035553Spatrick _LIBCPP_INLINE_VISIBILITY 128146035553Spatrick unordered_multiset& operator=(unordered_multiset&& __u) 128246035553Spatrick _NOEXCEPT_(is_nothrow_move_assignable<__table>::value); 128346035553Spatrick unordered_multiset& operator=(initializer_list<value_type> __il); 128446035553Spatrick#endif // _LIBCPP_CXX03_LANG 128546035553Spatrick 128646035553Spatrick _LIBCPP_INLINE_VISIBILITY 128746035553Spatrick allocator_type get_allocator() const _NOEXCEPT 128846035553Spatrick {return allocator_type(__table_.__node_alloc());} 128946035553Spatrick 129046035553Spatrick _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY 129146035553Spatrick bool empty() const _NOEXCEPT {return __table_.size() == 0;} 129246035553Spatrick _LIBCPP_INLINE_VISIBILITY 129346035553Spatrick size_type size() const _NOEXCEPT {return __table_.size();} 129446035553Spatrick _LIBCPP_INLINE_VISIBILITY 129546035553Spatrick size_type max_size() const _NOEXCEPT {return __table_.max_size();} 129646035553Spatrick 129746035553Spatrick _LIBCPP_INLINE_VISIBILITY 129846035553Spatrick iterator begin() _NOEXCEPT {return __table_.begin();} 129946035553Spatrick _LIBCPP_INLINE_VISIBILITY 130046035553Spatrick iterator end() _NOEXCEPT {return __table_.end();} 130146035553Spatrick _LIBCPP_INLINE_VISIBILITY 130246035553Spatrick const_iterator begin() const _NOEXCEPT {return __table_.begin();} 130346035553Spatrick _LIBCPP_INLINE_VISIBILITY 130446035553Spatrick const_iterator end() const _NOEXCEPT {return __table_.end();} 130546035553Spatrick _LIBCPP_INLINE_VISIBILITY 130646035553Spatrick const_iterator cbegin() const _NOEXCEPT {return __table_.begin();} 130746035553Spatrick _LIBCPP_INLINE_VISIBILITY 130846035553Spatrick const_iterator cend() const _NOEXCEPT {return __table_.end();} 130946035553Spatrick 131046035553Spatrick#ifndef _LIBCPP_CXX03_LANG 131146035553Spatrick template <class... _Args> 131246035553Spatrick _LIBCPP_INLINE_VISIBILITY 131346035553Spatrick iterator emplace(_Args&&... __args) 131446035553Spatrick {return __table_.__emplace_multi(_VSTD::forward<_Args>(__args)...);} 131546035553Spatrick template <class... _Args> 131646035553Spatrick _LIBCPP_INLINE_VISIBILITY 131746035553Spatrick iterator emplace_hint(const_iterator __p, _Args&&... __args) 131846035553Spatrick {return __table_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);} 131946035553Spatrick 132046035553Spatrick _LIBCPP_INLINE_VISIBILITY 132146035553Spatrick iterator insert(value_type&& __x) {return __table_.__insert_multi(_VSTD::move(__x));} 132246035553Spatrick _LIBCPP_INLINE_VISIBILITY 132346035553Spatrick iterator insert(const_iterator __p, value_type&& __x) 132446035553Spatrick {return __table_.__insert_multi(__p, _VSTD::move(__x));} 132546035553Spatrick _LIBCPP_INLINE_VISIBILITY 132646035553Spatrick void insert(initializer_list<value_type> __il) 132746035553Spatrick {insert(__il.begin(), __il.end());} 132846035553Spatrick#endif // _LIBCPP_CXX03_LANG 132946035553Spatrick 133046035553Spatrick _LIBCPP_INLINE_VISIBILITY 133146035553Spatrick iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);} 133246035553Spatrick 133346035553Spatrick _LIBCPP_INLINE_VISIBILITY 133446035553Spatrick iterator insert(const_iterator __p, const value_type& __x) 133546035553Spatrick {return __table_.__insert_multi(__p, __x);} 133646035553Spatrick 133746035553Spatrick template <class _InputIterator> 133846035553Spatrick _LIBCPP_INLINE_VISIBILITY 133946035553Spatrick void insert(_InputIterator __first, _InputIterator __last); 134046035553Spatrick 134146035553Spatrick#if _LIBCPP_STD_VER > 14 134246035553Spatrick _LIBCPP_INLINE_VISIBILITY 134346035553Spatrick iterator insert(node_type&& __nh) 134446035553Spatrick { 134546035553Spatrick _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), 134646035553Spatrick "node_type with incompatible allocator passed to unordered_multiset::insert()"); 134746035553Spatrick return __table_.template __node_handle_insert_multi<node_type>( 134846035553Spatrick _VSTD::move(__nh)); 134946035553Spatrick } 135046035553Spatrick _LIBCPP_INLINE_VISIBILITY 135146035553Spatrick iterator insert(const_iterator __hint, node_type&& __nh) 135246035553Spatrick { 135346035553Spatrick _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), 135446035553Spatrick "node_type with incompatible allocator passed to unordered_multiset::insert()"); 135546035553Spatrick return __table_.template __node_handle_insert_multi<node_type>( 135646035553Spatrick __hint, _VSTD::move(__nh)); 135746035553Spatrick } 135846035553Spatrick _LIBCPP_INLINE_VISIBILITY 135946035553Spatrick node_type extract(const_iterator __position) 136046035553Spatrick { 136146035553Spatrick return __table_.template __node_handle_extract<node_type>( 136246035553Spatrick __position); 136346035553Spatrick } 136446035553Spatrick _LIBCPP_INLINE_VISIBILITY 136546035553Spatrick node_type extract(key_type const& __key) 136646035553Spatrick { 136746035553Spatrick return __table_.template __node_handle_extract<node_type>(__key); 136846035553Spatrick } 136946035553Spatrick 137046035553Spatrick template <class _H2, class _P2> 137146035553Spatrick _LIBCPP_INLINE_VISIBILITY 137246035553Spatrick void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>& __source) 137346035553Spatrick { 137446035553Spatrick _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 137546035553Spatrick "merging container with incompatible allocator"); 137646035553Spatrick return __table_.__node_handle_merge_multi(__source.__table_); 137746035553Spatrick } 137846035553Spatrick template <class _H2, class _P2> 137946035553Spatrick _LIBCPP_INLINE_VISIBILITY 138046035553Spatrick void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>&& __source) 138146035553Spatrick { 138246035553Spatrick _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 138346035553Spatrick "merging container with incompatible allocator"); 138446035553Spatrick return __table_.__node_handle_merge_multi(__source.__table_); 138546035553Spatrick } 138646035553Spatrick template <class _H2, class _P2> 138746035553Spatrick _LIBCPP_INLINE_VISIBILITY 138846035553Spatrick void merge(unordered_set<key_type, _H2, _P2, allocator_type>& __source) 138946035553Spatrick { 139046035553Spatrick _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 139146035553Spatrick "merging container with incompatible allocator"); 139246035553Spatrick return __table_.__node_handle_merge_multi(__source.__table_); 139346035553Spatrick } 139446035553Spatrick template <class _H2, class _P2> 139546035553Spatrick _LIBCPP_INLINE_VISIBILITY 139646035553Spatrick void merge(unordered_set<key_type, _H2, _P2, allocator_type>&& __source) 139746035553Spatrick { 139846035553Spatrick _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 139946035553Spatrick "merging container with incompatible allocator"); 140046035553Spatrick return __table_.__node_handle_merge_multi(__source.__table_); 140146035553Spatrick } 140246035553Spatrick#endif 140346035553Spatrick 140446035553Spatrick _LIBCPP_INLINE_VISIBILITY 140546035553Spatrick iterator erase(const_iterator __p) {return __table_.erase(__p);} 140646035553Spatrick _LIBCPP_INLINE_VISIBILITY 140746035553Spatrick size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);} 140846035553Spatrick _LIBCPP_INLINE_VISIBILITY 140946035553Spatrick iterator erase(const_iterator __first, const_iterator __last) 141046035553Spatrick {return __table_.erase(__first, __last);} 141146035553Spatrick _LIBCPP_INLINE_VISIBILITY 141246035553Spatrick void clear() _NOEXCEPT {__table_.clear();} 141346035553Spatrick 141446035553Spatrick _LIBCPP_INLINE_VISIBILITY 141546035553Spatrick void swap(unordered_multiset& __u) 141646035553Spatrick _NOEXCEPT_(__is_nothrow_swappable<__table>::value) 141746035553Spatrick {__table_.swap(__u.__table_);} 141846035553Spatrick 141946035553Spatrick _LIBCPP_INLINE_VISIBILITY 142046035553Spatrick hasher hash_function() const {return __table_.hash_function();} 142146035553Spatrick _LIBCPP_INLINE_VISIBILITY 142246035553Spatrick key_equal key_eq() const {return __table_.key_eq();} 142346035553Spatrick 142446035553Spatrick _LIBCPP_INLINE_VISIBILITY 142546035553Spatrick iterator find(const key_type& __k) {return __table_.find(__k);} 142646035553Spatrick _LIBCPP_INLINE_VISIBILITY 142746035553Spatrick const_iterator find(const key_type& __k) const {return __table_.find(__k);} 142876d0caaeSpatrick#if _LIBCPP_STD_VER > 17 1429*4bdff4beSrobert template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 143076d0caaeSpatrick _LIBCPP_INLINE_VISIBILITY 1431*4bdff4beSrobert iterator find(const _K2& __k) {return __table_.find(__k);} 1432*4bdff4beSrobert template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 143376d0caaeSpatrick _LIBCPP_INLINE_VISIBILITY 1434*4bdff4beSrobert const_iterator find(const _K2& __k) const {return __table_.find(__k);} 143576d0caaeSpatrick#endif // _LIBCPP_STD_VER > 17 1436*4bdff4beSrobert 143746035553Spatrick _LIBCPP_INLINE_VISIBILITY 143846035553Spatrick size_type count(const key_type& __k) const {return __table_.__count_multi(__k);} 143946035553Spatrick#if _LIBCPP_STD_VER > 17 1440*4bdff4beSrobert template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 144176d0caaeSpatrick _LIBCPP_INLINE_VISIBILITY 1442*4bdff4beSrobert size_type count(const _K2& __k) const {return __table_.__count_multi(__k);} 144376d0caaeSpatrick#endif // _LIBCPP_STD_VER > 17 1444*4bdff4beSrobert 144576d0caaeSpatrick#if _LIBCPP_STD_VER > 17 144646035553Spatrick _LIBCPP_INLINE_VISIBILITY 144746035553Spatrick bool contains(const key_type& __k) const {return find(__k) != end();} 144876d0caaeSpatrick 1449*4bdff4beSrobert template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 145076d0caaeSpatrick _LIBCPP_INLINE_VISIBILITY 1451*4bdff4beSrobert bool contains(const _K2& __k) const {return find(__k) != end();} 145246035553Spatrick#endif // _LIBCPP_STD_VER > 17 1453*4bdff4beSrobert 145446035553Spatrick _LIBCPP_INLINE_VISIBILITY 145546035553Spatrick pair<iterator, iterator> equal_range(const key_type& __k) 145646035553Spatrick {return __table_.__equal_range_multi(__k);} 145746035553Spatrick _LIBCPP_INLINE_VISIBILITY 145846035553Spatrick pair<const_iterator, const_iterator> equal_range(const key_type& __k) const 145946035553Spatrick {return __table_.__equal_range_multi(__k);} 146076d0caaeSpatrick#if _LIBCPP_STD_VER > 17 1461*4bdff4beSrobert template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 146276d0caaeSpatrick _LIBCPP_INLINE_VISIBILITY 1463*4bdff4beSrobert pair<iterator, iterator> equal_range(const _K2& __k) 1464*4bdff4beSrobert {return __table_.__equal_range_multi(__k);} 1465*4bdff4beSrobert template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> 146676d0caaeSpatrick _LIBCPP_INLINE_VISIBILITY 1467*4bdff4beSrobert pair<const_iterator, const_iterator> equal_range(const _K2& __k) const 1468*4bdff4beSrobert {return __table_.__equal_range_multi(__k);} 146976d0caaeSpatrick#endif // _LIBCPP_STD_VER > 17 147046035553Spatrick 147146035553Spatrick _LIBCPP_INLINE_VISIBILITY 147246035553Spatrick size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();} 147346035553Spatrick _LIBCPP_INLINE_VISIBILITY 147446035553Spatrick size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();} 147546035553Spatrick 147646035553Spatrick _LIBCPP_INLINE_VISIBILITY 147746035553Spatrick size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);} 147846035553Spatrick _LIBCPP_INLINE_VISIBILITY 147946035553Spatrick size_type bucket(const key_type& __k) const {return __table_.bucket(__k);} 148046035553Spatrick 148146035553Spatrick _LIBCPP_INLINE_VISIBILITY 148246035553Spatrick local_iterator begin(size_type __n) {return __table_.begin(__n);} 148346035553Spatrick _LIBCPP_INLINE_VISIBILITY 148446035553Spatrick local_iterator end(size_type __n) {return __table_.end(__n);} 148546035553Spatrick _LIBCPP_INLINE_VISIBILITY 148646035553Spatrick const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);} 148746035553Spatrick _LIBCPP_INLINE_VISIBILITY 148846035553Spatrick const_local_iterator end(size_type __n) const {return __table_.cend(__n);} 148946035553Spatrick _LIBCPP_INLINE_VISIBILITY 149046035553Spatrick const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);} 149146035553Spatrick _LIBCPP_INLINE_VISIBILITY 149246035553Spatrick const_local_iterator cend(size_type __n) const {return __table_.cend(__n);} 149346035553Spatrick 149446035553Spatrick _LIBCPP_INLINE_VISIBILITY 149546035553Spatrick float load_factor() const _NOEXCEPT {return __table_.load_factor();} 149646035553Spatrick _LIBCPP_INLINE_VISIBILITY 149746035553Spatrick float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();} 149846035553Spatrick _LIBCPP_INLINE_VISIBILITY 149946035553Spatrick void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);} 150046035553Spatrick _LIBCPP_INLINE_VISIBILITY 1501*4bdff4beSrobert void rehash(size_type __n) {__table_.__rehash_multi(__n);} 150246035553Spatrick _LIBCPP_INLINE_VISIBILITY 1503*4bdff4beSrobert void reserve(size_type __n) {__table_.__reserve_multi(__n);} 150446035553Spatrick 1505*4bdff4beSrobert#ifdef _LIBCPP_ENABLE_DEBUG_MODE 150646035553Spatrick 150746035553Spatrick bool __dereferenceable(const const_iterator* __i) const 150846035553Spatrick {return __table_.__dereferenceable(__i);} 150946035553Spatrick bool __decrementable(const const_iterator* __i) const 151046035553Spatrick {return __table_.__decrementable(__i);} 151146035553Spatrick bool __addable(const const_iterator* __i, ptrdiff_t __n) const 151246035553Spatrick {return __table_.__addable(__i, __n);} 151346035553Spatrick bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const 151446035553Spatrick {return __table_.__addable(__i, __n);} 151546035553Spatrick 1516*4bdff4beSrobert#endif // _LIBCPP_ENABLE_DEBUG_MODE 151746035553Spatrick 151846035553Spatrick}; 151946035553Spatrick 1520*4bdff4beSrobert#if _LIBCPP_STD_VER >= 17 152146035553Spatricktemplate<class _InputIterator, 152246035553Spatrick class _Hash = hash<__iter_value_type<_InputIterator>>, 152346035553Spatrick class _Pred = equal_to<__iter_value_type<_InputIterator>>, 152446035553Spatrick class _Allocator = allocator<__iter_value_type<_InputIterator>>, 1525*4bdff4beSrobert class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, 1526*4bdff4beSrobert class = enable_if_t<!__is_allocator<_Hash>::value>, 1527*4bdff4beSrobert class = enable_if_t<!is_integral<_Hash>::value>, 1528*4bdff4beSrobert class = enable_if_t<!__is_allocator<_Pred>::value>, 1529*4bdff4beSrobert class = enable_if_t<__is_allocator<_Allocator>::value>> 153046035553Spatrickunordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0, 153146035553Spatrick _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) 153246035553Spatrick -> unordered_multiset<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>; 153346035553Spatrick 153446035553Spatricktemplate<class _Tp, class _Hash = hash<_Tp>, 153546035553Spatrick class _Pred = equal_to<_Tp>, class _Allocator = allocator<_Tp>, 1536*4bdff4beSrobert class = enable_if_t<!__is_allocator<_Hash>::value>, 1537*4bdff4beSrobert class = enable_if_t<!is_integral<_Hash>::value>, 1538*4bdff4beSrobert class = enable_if_t<!__is_allocator<_Pred>::value>, 1539*4bdff4beSrobert class = enable_if_t<__is_allocator<_Allocator>::value>> 154046035553Spatrickunordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type = 0, 154146035553Spatrick _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) 154246035553Spatrick -> unordered_multiset<_Tp, _Hash, _Pred, _Allocator>; 154346035553Spatrick 154446035553Spatricktemplate<class _InputIterator, class _Allocator, 1545*4bdff4beSrobert class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, 1546*4bdff4beSrobert class = enable_if_t<__is_allocator<_Allocator>::value>> 154746035553Spatrickunordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator) 154846035553Spatrick -> unordered_multiset<__iter_value_type<_InputIterator>, 154946035553Spatrick hash<__iter_value_type<_InputIterator>>, 155046035553Spatrick equal_to<__iter_value_type<_InputIterator>>, 155146035553Spatrick _Allocator>; 155246035553Spatrick 155346035553Spatricktemplate<class _InputIterator, class _Hash, class _Allocator, 1554*4bdff4beSrobert class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, 1555*4bdff4beSrobert class = enable_if_t<!__is_allocator<_Hash>::value>, 1556*4bdff4beSrobert class = enable_if_t<!is_integral<_Hash>::value>, 1557*4bdff4beSrobert class = enable_if_t<__is_allocator<_Allocator>::value>> 155846035553Spatrickunordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, 155946035553Spatrick _Hash, _Allocator) 156046035553Spatrick -> unordered_multiset<__iter_value_type<_InputIterator>, _Hash, 156146035553Spatrick equal_to<__iter_value_type<_InputIterator>>, 156246035553Spatrick _Allocator>; 156346035553Spatrick 156446035553Spatricktemplate<class _Tp, class _Allocator, 1565*4bdff4beSrobert class = enable_if_t<__is_allocator<_Allocator>::value>> 156646035553Spatrickunordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Allocator) 156746035553Spatrick -> unordered_multiset<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>; 156846035553Spatrick 156946035553Spatricktemplate<class _Tp, class _Hash, class _Allocator, 1570*4bdff4beSrobert class = enable_if_t<!__is_allocator<_Hash>::value>, 1571*4bdff4beSrobert class = enable_if_t<!is_integral<_Hash>::value>, 1572*4bdff4beSrobert class = enable_if_t<__is_allocator<_Allocator>::value>> 157346035553Spatrickunordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator) 157446035553Spatrick -> unordered_multiset<_Tp, _Hash, equal_to<_Tp>, _Allocator>; 157546035553Spatrick#endif 157646035553Spatrick 157746035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 157846035553Spatrickunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 157946035553Spatrick size_type __n, const hasher& __hf, const key_equal& __eql) 158046035553Spatrick : __table_(__hf, __eql) 158146035553Spatrick{ 1582*4bdff4beSrobert _VSTD::__debug_db_insert_c(this); 1583*4bdff4beSrobert __table_.__rehash_multi(__n); 158446035553Spatrick} 158546035553Spatrick 158646035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 158746035553Spatrickunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 158846035553Spatrick size_type __n, const hasher& __hf, const key_equal& __eql, 158946035553Spatrick const allocator_type& __a) 159046035553Spatrick : __table_(__hf, __eql, __a) 159146035553Spatrick{ 1592*4bdff4beSrobert _VSTD::__debug_db_insert_c(this); 1593*4bdff4beSrobert __table_.__rehash_multi(__n); 159446035553Spatrick} 159546035553Spatrick 159646035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 159746035553Spatricktemplate <class _InputIterator> 159846035553Spatrickunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 159946035553Spatrick _InputIterator __first, _InputIterator __last) 160046035553Spatrick{ 1601*4bdff4beSrobert _VSTD::__debug_db_insert_c(this); 160246035553Spatrick insert(__first, __last); 160346035553Spatrick} 160446035553Spatrick 160546035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 160646035553Spatricktemplate <class _InputIterator> 160746035553Spatrickunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 160846035553Spatrick _InputIterator __first, _InputIterator __last, size_type __n, 160946035553Spatrick const hasher& __hf, const key_equal& __eql) 161046035553Spatrick : __table_(__hf, __eql) 161146035553Spatrick{ 1612*4bdff4beSrobert _VSTD::__debug_db_insert_c(this); 1613*4bdff4beSrobert __table_.__rehash_multi(__n); 161446035553Spatrick insert(__first, __last); 161546035553Spatrick} 161646035553Spatrick 161746035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 161846035553Spatricktemplate <class _InputIterator> 161946035553Spatrickunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 162046035553Spatrick _InputIterator __first, _InputIterator __last, size_type __n, 162146035553Spatrick const hasher& __hf, const key_equal& __eql, const allocator_type& __a) 162246035553Spatrick : __table_(__hf, __eql, __a) 162346035553Spatrick{ 1624*4bdff4beSrobert _VSTD::__debug_db_insert_c(this); 1625*4bdff4beSrobert __table_.__rehash_multi(__n); 162646035553Spatrick insert(__first, __last); 162746035553Spatrick} 162846035553Spatrick 162946035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 163046035553Spatrickinline 163146035553Spatrickunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 163246035553Spatrick const allocator_type& __a) 163346035553Spatrick : __table_(__a) 163446035553Spatrick{ 1635*4bdff4beSrobert _VSTD::__debug_db_insert_c(this); 163646035553Spatrick} 163746035553Spatrick 163846035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 163946035553Spatrickunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 164046035553Spatrick const unordered_multiset& __u) 164146035553Spatrick : __table_(__u.__table_) 164246035553Spatrick{ 1643*4bdff4beSrobert _VSTD::__debug_db_insert_c(this); 1644*4bdff4beSrobert __table_.__rehash_multi(__u.bucket_count()); 164546035553Spatrick insert(__u.begin(), __u.end()); 164646035553Spatrick} 164746035553Spatrick 164846035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 164946035553Spatrickunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 165046035553Spatrick const unordered_multiset& __u, const allocator_type& __a) 165146035553Spatrick : __table_(__u.__table_, __a) 165246035553Spatrick{ 1653*4bdff4beSrobert _VSTD::__debug_db_insert_c(this); 1654*4bdff4beSrobert __table_.__rehash_multi(__u.bucket_count()); 165546035553Spatrick insert(__u.begin(), __u.end()); 165646035553Spatrick} 165746035553Spatrick 165846035553Spatrick#ifndef _LIBCPP_CXX03_LANG 165946035553Spatrick 166046035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 166146035553Spatrickinline 166246035553Spatrickunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 166346035553Spatrick unordered_multiset&& __u) 166446035553Spatrick _NOEXCEPT_(is_nothrow_move_constructible<__table>::value) 166546035553Spatrick : __table_(_VSTD::move(__u.__table_)) 166646035553Spatrick{ 1667*4bdff4beSrobert _VSTD::__debug_db_insert_c(this); 1668*4bdff4beSrobert std::__debug_db_swap(this, std::addressof(__u)); 166946035553Spatrick} 167046035553Spatrick 167146035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 167246035553Spatrickunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 167346035553Spatrick unordered_multiset&& __u, const allocator_type& __a) 167446035553Spatrick : __table_(_VSTD::move(__u.__table_), __a) 167546035553Spatrick{ 1676*4bdff4beSrobert _VSTD::__debug_db_insert_c(this); 167746035553Spatrick if (__a != __u.get_allocator()) 167846035553Spatrick { 167946035553Spatrick iterator __i = __u.begin(); 168046035553Spatrick while (__u.size() != 0) 168146035553Spatrick __table_.__insert_multi(_VSTD::move(__u.__table_.remove(__i++)->__value_)); 168246035553Spatrick } 168346035553Spatrick else 1684*4bdff4beSrobert std::__debug_db_swap(this, std::addressof(__u)); 168546035553Spatrick} 168646035553Spatrick 168746035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 168846035553Spatrickunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 168946035553Spatrick initializer_list<value_type> __il) 169046035553Spatrick{ 1691*4bdff4beSrobert _VSTD::__debug_db_insert_c(this); 169246035553Spatrick insert(__il.begin(), __il.end()); 169346035553Spatrick} 169446035553Spatrick 169546035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 169646035553Spatrickunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 169746035553Spatrick initializer_list<value_type> __il, size_type __n, const hasher& __hf, 169846035553Spatrick const key_equal& __eql) 169946035553Spatrick : __table_(__hf, __eql) 170046035553Spatrick{ 1701*4bdff4beSrobert _VSTD::__debug_db_insert_c(this); 1702*4bdff4beSrobert __table_.__rehash_multi(__n); 170346035553Spatrick insert(__il.begin(), __il.end()); 170446035553Spatrick} 170546035553Spatrick 170646035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 170746035553Spatrickunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 170846035553Spatrick initializer_list<value_type> __il, size_type __n, const hasher& __hf, 170946035553Spatrick const key_equal& __eql, const allocator_type& __a) 171046035553Spatrick : __table_(__hf, __eql, __a) 171146035553Spatrick{ 1712*4bdff4beSrobert _VSTD::__debug_db_insert_c(this); 1713*4bdff4beSrobert __table_.__rehash_multi(__n); 171446035553Spatrick insert(__il.begin(), __il.end()); 171546035553Spatrick} 171646035553Spatrick 171746035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 171846035553Spatrickinline 171946035553Spatrickunordered_multiset<_Value, _Hash, _Pred, _Alloc>& 172046035553Spatrickunordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=( 172146035553Spatrick unordered_multiset&& __u) 172246035553Spatrick _NOEXCEPT_(is_nothrow_move_assignable<__table>::value) 172346035553Spatrick{ 172446035553Spatrick __table_ = _VSTD::move(__u.__table_); 172546035553Spatrick return *this; 172646035553Spatrick} 172746035553Spatrick 172846035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 172946035553Spatrickinline 173046035553Spatrickunordered_multiset<_Value, _Hash, _Pred, _Alloc>& 173146035553Spatrickunordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=( 173246035553Spatrick initializer_list<value_type> __il) 173346035553Spatrick{ 173446035553Spatrick __table_.__assign_multi(__il.begin(), __il.end()); 173546035553Spatrick return *this; 173646035553Spatrick} 173746035553Spatrick 173846035553Spatrick#endif // _LIBCPP_CXX03_LANG 173946035553Spatrick 174046035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 174146035553Spatricktemplate <class _InputIterator> 174246035553Spatrickinline 174346035553Spatrickvoid 174446035553Spatrickunordered_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, 174546035553Spatrick _InputIterator __last) 174646035553Spatrick{ 174746035553Spatrick for (; __first != __last; ++__first) 174846035553Spatrick __table_.__insert_multi(*__first); 174946035553Spatrick} 175046035553Spatrick 175146035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 175246035553Spatrickinline _LIBCPP_INLINE_VISIBILITY 175346035553Spatrickvoid 175446035553Spatrickswap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, 175546035553Spatrick unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) 175646035553Spatrick _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) 175746035553Spatrick{ 175846035553Spatrick __x.swap(__y); 175946035553Spatrick} 176046035553Spatrick 176146035553Spatrick#if _LIBCPP_STD_VER > 17 1762037e7968Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc, 1763037e7968Spatrick class _Predicate> 176446035553Spatrickinline _LIBCPP_INLINE_VISIBILITY 1765037e7968Spatrick typename unordered_multiset<_Value, _Hash, _Pred, _Alloc>::size_type 1766037e7968Spatrick erase_if(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __c, 1767037e7968Spatrick _Predicate __pred) { 176876d0caaeSpatrick return _VSTD::__libcpp_erase_if_container(__c, __pred); 1769037e7968Spatrick} 177046035553Spatrick#endif 177146035553Spatrick 177246035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 1773*4bdff4beSrobert_LIBCPP_HIDE_FROM_ABI bool 177446035553Spatrickoperator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, 177546035553Spatrick const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) 177646035553Spatrick{ 177746035553Spatrick if (__x.size() != __y.size()) 177846035553Spatrick return false; 177946035553Spatrick typedef typename unordered_multiset<_Value, _Hash, _Pred, _Alloc>::const_iterator 178046035553Spatrick const_iterator; 178146035553Spatrick typedef pair<const_iterator, const_iterator> _EqRng; 178246035553Spatrick for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;) 178346035553Spatrick { 178446035553Spatrick _EqRng __xeq = __x.equal_range(*__i); 178546035553Spatrick _EqRng __yeq = __y.equal_range(*__i); 178646035553Spatrick if (_VSTD::distance(__xeq.first, __xeq.second) != 178746035553Spatrick _VSTD::distance(__yeq.first, __yeq.second) || 178846035553Spatrick !_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first)) 178946035553Spatrick return false; 179046035553Spatrick __i = __xeq.second; 179146035553Spatrick } 179246035553Spatrick return true; 179346035553Spatrick} 179446035553Spatrick 179546035553Spatricktemplate <class _Value, class _Hash, class _Pred, class _Alloc> 179646035553Spatrickinline _LIBCPP_INLINE_VISIBILITY 179746035553Spatrickbool 179846035553Spatrickoperator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, 179946035553Spatrick const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) 180046035553Spatrick{ 180146035553Spatrick return !(__x == __y); 180246035553Spatrick} 180346035553Spatrick 180446035553Spatrick_LIBCPP_END_NAMESPACE_STD 180546035553Spatrick 1806*4bdff4beSrobert#if _LIBCPP_STD_VER > 14 1807*4bdff4beSrobert_LIBCPP_BEGIN_NAMESPACE_STD 1808*4bdff4beSrobertnamespace pmr { 1809*4bdff4beSroberttemplate <class _KeyT, class _HashT = std::hash<_KeyT>, class _PredT = std::equal_to<_KeyT>> 1810*4bdff4beSrobertusing unordered_set = std::unordered_set<_KeyT, _HashT, _PredT, polymorphic_allocator<_KeyT>>; 1811*4bdff4beSrobert 1812*4bdff4beSroberttemplate <class _KeyT, class _HashT = std::hash<_KeyT>, class _PredT = std::equal_to<_KeyT>> 1813*4bdff4beSrobertusing unordered_multiset = std::unordered_multiset<_KeyT, _HashT, _PredT, polymorphic_allocator<_KeyT>>; 1814*4bdff4beSrobert} // namespace pmr 1815*4bdff4beSrobert_LIBCPP_END_NAMESPACE_STD 1816*4bdff4beSrobert#endif 1817*4bdff4beSrobert 1818*4bdff4beSrobert#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 1819*4bdff4beSrobert# include <concepts> 1820*4bdff4beSrobert# include <functional> 1821*4bdff4beSrobert# include <iterator> 1822*4bdff4beSrobert#endif 1823*4bdff4beSrobert 182446035553Spatrick#endif // _LIBCPP_UNORDERED_SET 1825