60 #if __cplusplus >= 201103L 64 namespace std _GLIBCXX_VISIBILITY(default)
66 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
68 template<
typename _Key,
typename _Compare,
typename _Alloc>
91 template<
typename _Key,
typename _Compare = std::less<_Key>,
92 typename _Alloc = std::allocator<_Key> >
95 #ifdef _GLIBCXX_CONCEPT_CHECKS 97 typedef typename _Alloc::value_type _Alloc_value_type;
98 # if __cplusplus < 201103L 99 __glibcxx_class_requires(_Key, _SGIAssignableConcept)
101 __glibcxx_class_requires4(_Compare,
bool, _Key, _Key,
102 _BinaryFunctionConcept)
103 __glibcxx_class_requires2(_Key, _Alloc_value_type, _SameTypeConcept)
119 rebind<_Key>::other _Key_alloc_type;
121 typedef _Rb_tree<key_type, value_type, _Identity<value_type>,
130 typedef typename _Alloc_traits::pointer
pointer;
137 typedef typename _Rep_type::const_iterator
iterator;
145 #if __cplusplus > 201402L 146 using node_type =
typename _Rep_type::node_type;
147 using insert_return_type =
typename _Rep_type::insert_return_type;
154 #if __cplusplus < 201103L 166 set(
const _Compare& __comp,
168 : _M_t(__comp, _Key_alloc_type(__a)) { }
180 template<
typename _InputIterator>
181 set(_InputIterator __first, _InputIterator __last)
183 { _M_t._M_insert_unique(__first, __last); }
197 template<
typename _InputIterator>
198 set(_InputIterator __first, _InputIterator __last,
199 const _Compare& __comp,
201 : _M_t(__comp, _Key_alloc_type(__a))
202 { _M_t._M_insert_unique(__first, __last); }
209 #if __cplusplus < 201103L 213 set(
const set&) =
default;
221 set(
set&&) =
default;
234 const _Compare& __comp = _Compare(),
236 : _M_t(__comp, _Key_alloc_type(__a))
237 { _M_t._M_insert_unique(__l.begin(), __l.end()); }
241 set(
const allocator_type& __a)
242 : _M_t(_Compare(), _Key_alloc_type(__a)) { }
245 set(
const set& __x,
const allocator_type& __a)
246 : _M_t(__x._M_t, _Key_alloc_type(__a)) { }
249 set(
set&& __x,
const allocator_type& __a)
250 noexcept(is_nothrow_copy_constructible<_Compare>::value
251 && _Alloc_traits::_S_always_equal())
252 : _M_t(std::move(__x._M_t), _Key_alloc_type(__a)) { }
256 : _M_t(_Compare(), _Key_alloc_type(__a))
257 { _M_t._M_insert_unique(__l.begin(), __l.end()); }
260 template<
typename _InputIterator>
261 set(_InputIterator __first, _InputIterator __last,
262 const allocator_type& __a)
263 : _M_t(_Compare(), _Key_alloc_type(__a))
264 { _M_t._M_insert_unique(__first, __last); }
279 #if __cplusplus < 201103L 308 _M_t._M_assign_unique(__l.begin(), __l.end());
318 {
return _M_t.key_comp(); }
322 {
return _M_t.key_comp(); }
335 {
return _M_t.begin(); }
343 end() const _GLIBCXX_NOEXCEPT
344 {
return _M_t.end(); }
353 {
return _M_t.rbegin(); }
362 {
return _M_t.rend(); }
364 #if __cplusplus >= 201103L 372 {
return _M_t.begin(); }
381 {
return _M_t.end(); }
390 {
return _M_t.rbegin(); }
399 {
return _M_t.rend(); }
405 {
return _M_t.empty(); }
410 {
return _M_t.size(); }
415 {
return _M_t.max_size(); }
432 _GLIBCXX_NOEXCEPT_IF(__is_nothrow_swappable<_Compare>::value)
433 { _M_t.swap(__x._M_t); }
436 #if __cplusplus >= 201103L 450 template<
typename... _Args>
453 {
return _M_t._M_emplace_unique(std::forward<_Args>(__args)...); }
476 template<
typename... _Args>
480 return _M_t._M_emplace_hint_unique(__pos,
481 std::forward<_Args>(__args)...);
502 _M_t._M_insert_unique(__x);
506 #if __cplusplus >= 201103L 511 _M_t._M_insert_unique(std::move(__x));
536 insert(const_iterator __position,
const value_type& __x)
537 {
return _M_t._M_insert_unique_(__position, __x); }
539 #if __cplusplus >= 201103L 541 insert(const_iterator __position, value_type&& __x)
542 {
return _M_t._M_insert_unique_(__position, std::move(__x)); }
554 template<
typename _InputIterator>
556 insert(_InputIterator __first, _InputIterator __last)
557 { _M_t._M_insert_unique(__first, __last); }
559 #if __cplusplus >= 201103L 569 { this->
insert(__l.begin(), __l.end()); }
572 #if __cplusplus > 201402L 575 extract(const_iterator __pos)
577 __glibcxx_assert(__pos !=
end());
578 return _M_t.extract(__pos);
583 extract(
const key_type& __x)
584 {
return _M_t.extract(__x); }
589 {
return _M_t._M_reinsert_node_unique(std::move(__nh)); }
593 insert(const_iterator __hint, node_type&& __nh)
594 {
return _M_t._M_reinsert_node_hint_unique(__hint, std::move(__nh)); }
596 template<
typename,
typename>
597 friend class _Rb_tree_merge_helper;
599 template<
typename _Compare1>
603 using _Merge_helper = _Rb_tree_merge_helper<set, _Compare1>;
604 _M_t._M_merge_unique(_Merge_helper::_S_get_tree(__source));
607 template<
typename _Compare1>
612 template<
typename _Compare1>
616 using _Merge_helper = _Rb_tree_merge_helper<set, _Compare1>;
617 _M_t._M_merge_unique(_Merge_helper::_S_get_tree(__source));
620 template<
typename _Compare1>
626 #if __cplusplus >= 201103L 642 _GLIBCXX_ABI_TAG_CXX11
645 {
return _M_t.erase(__position); }
658 erase(iterator __position)
659 { _M_t.erase(__position); }
675 {
return _M_t.erase(__x); }
677 #if __cplusplus >= 201103L 694 _GLIBCXX_ABI_TAG_CXX11
696 erase(const_iterator __first, const_iterator __last)
697 {
return _M_t.erase(__first, __last); }
712 erase(iterator __first, iterator __last)
713 { _M_t.erase(__first, __last); }
739 {
return _M_t.find(__x) == _M_t.end() ? 0 : 1; }
741 #if __cplusplus > 201103L 742 template<
typename _Kt>
745 -> decltype(_M_t._M_count_tr(__x))
746 {
return _M_t._M_count_tr(__x); }
766 {
return _M_t.find(__x); }
769 find(
const key_type& __x)
const 770 {
return _M_t.find(__x); }
772 #if __cplusplus > 201103L 773 template<
typename _Kt>
776 -> decltype(iterator{_M_t._M_find_tr(__x)})
777 {
return iterator{_M_t._M_find_tr(__x)}; }
779 template<
typename _Kt>
782 -> decltype(const_iterator{_M_t._M_find_tr(__x)})
783 {
return const_iterator{_M_t._M_find_tr(__x)}; }
801 {
return _M_t.lower_bound(__x); }
805 {
return _M_t.lower_bound(__x); }
807 #if __cplusplus > 201103L 808 template<
typename _Kt>
811 -> decltype(
iterator(_M_t._M_lower_bound_tr(__x)))
812 {
return iterator(_M_t._M_lower_bound_tr(__x)); }
814 template<
typename _Kt>
831 {
return _M_t.upper_bound(__x); }
835 {
return _M_t.upper_bound(__x); }
837 #if __cplusplus > 201103L 838 template<
typename _Kt>
841 -> decltype(
iterator(_M_t._M_upper_bound_tr(__x)))
842 {
return iterator(_M_t._M_upper_bound_tr(__x)); }
844 template<
typename _Kt>
847 -> decltype(
iterator(_M_t._M_upper_bound_tr(__x)))
870 {
return _M_t.equal_range(__x); }
874 {
return _M_t.equal_range(__x); }
876 #if __cplusplus > 201103L 877 template<
typename _Kt>
883 template<
typename _Kt>
891 template<
typename _K1,
typename _C1,
typename _A1>
895 template<
typename _K1,
typename _C1,
typename _A1>
911 template<
typename _Key,
typename _Compare,
typename _Alloc>
915 {
return __x._M_t == __y._M_t; }
928 template<
typename _Key,
typename _Compare,
typename _Alloc>
930 operator<(const set<_Key, _Compare, _Alloc>& __x,
932 {
return __x._M_t < __y._M_t; }
935 template<
typename _Key,
typename _Compare,
typename _Alloc>
939 {
return !(__x == __y); }
942 template<
typename _Key,
typename _Compare,
typename _Alloc>
946 {
return __y < __x; }
949 template<
typename _Key,
typename _Compare,
typename _Alloc>
951 operator<=(const set<_Key, _Compare, _Alloc>& __x,
953 {
return !(__y < __x); }
956 template<
typename _Key,
typename _Compare,
typename _Alloc>
960 {
return !(__x < __y); }
963 template<
typename _Key,
typename _Compare,
typename _Alloc>
966 _GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y)))
969 _GLIBCXX_END_NAMESPACE_CONTAINER
971 #if __cplusplus > 201402L 972 _GLIBCXX_BEGIN_NAMESPACE_VERSION
974 template<
typename _Val,
typename _Cmp1,
typename _Alloc,
typename _Cmp2>
976 _Rb_tree_merge_helper<_GLIBCXX_STD_C::set<_Val, _Cmp1, _Alloc>, _Cmp2>
979 friend class _GLIBCXX_STD_C::set<_Val, _Cmp1, _Alloc>;
982 _S_get_tree(_GLIBCXX_STD_C::set<_Val, _Cmp2, _Alloc>& __set)
983 {
return __set._M_t; }
986 _S_get_tree(_GLIBCXX_STD_C::multiset<_Val, _Cmp2, _Alloc>& __set)
987 {
return __set._M_t; }
989 _GLIBCXX_END_NAMESPACE_VERSION
_T2 second
first is a copy of the first object
iterator begin() const noexcept
const_iterator find(const key_type &__x) const
Tries to locate an element in a set.
bool operator>(const set< _Key, _Compare, _Alloc > &__x, const set< _Key, _Compare, _Alloc > &__y)
Returns y < x.
_Rep_type::difference_type difference_type
Iterator-related typedefs.
_GLIBCXX_ABI_TAG_CXX11 iterator erase(const_iterator __position)
Erases an element from a set.
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key.
key_compare key_comp() const
Returns the comparison object with which the set was constructed.
auto equal_range(const _Kt &__x) -> decltype(pair< iterator, iterator >(_M_t._M_equal_range_tr(__x)))
Finds a subsequence matching given key.
Uniform interface to C++98 and C++11 allocators.
size_type size() const noexcept
Returns the size of the set.
void swap(set &__x) noexcept(/*conditional */)
Swaps data with another set.
bool empty() const noexcept
Returns true if the set is empty.
void insert(initializer_list< value_type > __l)
Attempts to insert a list of elements into the set.
bool operator>=(const set< _Key, _Compare, _Alloc > &__x, const set< _Key, _Compare, _Alloc > &__y)
Returns !(x < y)
bool operator==(const set< _Key, _Compare, _Alloc > &__x, const set< _Key, _Compare, _Alloc > &__y)
Set equality comparison.
auto count(const _Kt &__x) const -> decltype(_M_t._M_count_tr(__x))
Finds the number of elements.
reverse_iterator crbegin() const noexcept
_Rep_type::const_reverse_iterator const_reverse_iterator
Iterator-related typedefs.
_Rep_type::const_iterator const_iterator
Iterator-related typedefs.
_T1 first
second_type is the second bound type
allocator_type get_allocator() const noexcept
Returns the allocator object with which the set was constructed.
_Compare value_compare
Public typedefs.
auto find(const _Kt &__x) const -> decltype(const_iterator
Tries to locate an element in a set.
_Alloc_traits::reference reference
Iterator-related typedefs.
size_type max_size() const noexcept
Returns the maximum size of the set.
set & operator=(const set &)=default
Set assignment operator.
std::pair< iterator, bool > emplace(_Args &&...__args)
Attempts to build and insert an element into the set.
_Key key_type
Public typedefs.
const_iterator upper_bound(const key_type &__x) const
Finds the end of a subsequence matching given key.
value_compare value_comp() const
Returns the comparison object with which the set was constructed.
_Rep_type::size_type size_type
Iterator-related typedefs.
ISO C++ entities toplevel namespace is std.
_Compare key_compare
Public typedefs.
iterator cbegin() const noexcept
std::pair< const_iterator, const_iterator > equal_range(const key_type &__x) const
Finds a subsequence matching given key.
iterator upper_bound(const key_type &__x)
Finds the end of a subsequence matching given key.
_Alloc_traits::const_pointer const_pointer
Iterator-related typedefs.
iterator emplace_hint(const_iterator __pos, _Args &&...__args)
Attempts to insert an element into the set.
iterator cend() const noexcept
auto lower_bound(const _Kt &__x) -> decltype(iterator(_M_t._M_lower_bound_tr(__x)))
Finds the beginning of a subsequence matching given key.
auto upper_bound(const _Kt &__x) const -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
Finds the end of a subsequence matching given key.
_Key value_type
Public typedefs.
Struct holding two objects of arbitrary type.
std::pair< iterator, bool > insert(const value_type &__x)
Attempts to insert an element into the set.
bool operator!=(const set< _Key, _Compare, _Alloc > &__x, const set< _Key, _Compare, _Alloc > &__y)
Returns !(x == y).
void insert(_InputIterator __first, _InputIterator __last)
A template function that attempts to insert a range of elements.
reverse_iterator rend() const noexcept
size_type erase(const key_type &__x)
Erases elements according to the provided key.
A standard container made up of unique keys, which can be retrieved in logarithmic time...
auto find(const _Kt &__x) -> decltype(iterator
Tries to locate an element in a set.
const_iterator lower_bound(const key_type &__x) const
Finds the beginning of a subsequence matching given key.
auto upper_bound(const _Kt &__x) -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
Finds the end of a subsequence matching given key.
set & operator=(initializer_list< value_type > __l)
Set list assignment operator.
iterator find(const key_type &__x)
Tries to locate an element in a set.
_Alloc_traits::pointer pointer
Iterator-related typedefs.
_Alloc allocator_type
Public typedefs.
A standard container made up of elements, which can be retrieved in logarithmic time.
auto equal_range(const _Kt &__x) const -> decltype(pair< iterator, iterator >(_M_t._M_equal_range_tr(__x)))
Finds a subsequence matching given key.
iterator end() const noexcept
_Rep_type::const_iterator iterator
Iterator-related typedefs.
size_type count(const key_type &__x) const
Finds the number of elements.
reverse_iterator crend() const noexcept
reverse_iterator rbegin() const noexcept
_Rep_type::const_reverse_iterator reverse_iterator
Iterator-related typedefs.
iterator insert(const_iterator __position, const value_type &__x)
Attempts to insert an element into the set.
_GLIBCXX_ABI_TAG_CXX11 iterator erase(const_iterator __first, const_iterator __last)
Erases a [__first,__last) range of elements from a set.
_Alloc_traits::const_reference const_reference
Iterator-related typedefs.
iterator lower_bound(const key_type &__x)
Finds the beginning of a subsequence matching given key.
auto lower_bound(const _Kt &__x) const -> decltype(const_iterator(_M_t._M_lower_bound_tr(__x)))
Finds the beginning of a subsequence matching given key.