60 #if __cplusplus >= 201103L 64 namespace std _GLIBCXX_VISIBILITY(default)
66 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
88 template<
typename _Key,
typename _Compare = std::less<_Key>,
89 typename _Alloc = std::allocator<_Key> >
93 typedef typename _Alloc::value_type _Alloc_value_type;
94 __glibcxx_class_requires(_Key, _SGIAssignableConcept)
95 __glibcxx_class_requires4(_Compare,
bool, _Key, _Key,
96 _BinaryFunctionConcept)
97 __glibcxx_class_requires2(_Key, _Alloc_value_type, _SameTypeConcept)
112 rebind<_Key>::other _Key_alloc_type;
114 typedef _Rb_tree<key_type, value_type, _Identity<value_type>,
123 typedef typename _Alloc_traits::pointer
pointer;
130 typedef typename _Rep_type::const_iterator
iterator;
143 #
if __cplusplus >= 201103L
144 noexcept(is_nothrow_default_constructible<allocator_type>::value)
154 set(
const _Compare& __comp,
156 : _M_t(__comp, _Key_alloc_type(__a)) { }
168 template<
typename _InputIterator>
169 set(_InputIterator __first, _InputIterator __last)
171 { _M_t._M_insert_unique(__first, __last); }
185 template<
typename _InputIterator>
186 set(_InputIterator __first, _InputIterator __last,
187 const _Compare& __comp,
189 : _M_t(__comp, _Key_alloc_type(__a))
190 { _M_t._M_insert_unique(__first, __last); }
202 #if __cplusplus >= 201103L 211 noexcept(is_nothrow_copy_constructible<_Compare>::value)
212 : _M_t(std::move(__x._M_t)) { }
225 const _Compare& __comp = _Compare(),
227 : _M_t(__comp, _Key_alloc_type(__a))
228 { _M_t._M_insert_unique(__l.begin(), __l.end()); }
232 set(
const allocator_type& __a)
233 : _M_t(_Compare(), _Key_alloc_type(__a)) { }
236 set(
const set& __x,
const allocator_type& __a)
237 : _M_t(__x._M_t, _Key_alloc_type(__a)) { }
240 set(
set&& __x,
const allocator_type& __a)
241 noexcept(is_nothrow_copy_constructible<_Compare>::value
242 && _Alloc_traits::_S_always_equal())
243 : _M_t(std::move(__x._M_t), _Key_alloc_type(__a)) { }
247 : _M_t(_Compare(), _Key_alloc_type(__a))
248 { _M_t._M_insert_unique(__l.begin(), __l.end()); }
251 template<
typename _InputIterator>
252 set(_InputIterator __first, _InputIterator __last,
253 const allocator_type& __a)
254 : _M_t(_Compare(), _Key_alloc_type(__a))
255 { _M_t._M_insert_unique(__first, __last); }
272 #if __cplusplus >= 201103L 291 _M_t._M_assign_unique(__l.begin(), __l.end());
301 {
return _M_t.key_comp(); }
305 {
return _M_t.key_comp(); }
318 {
return _M_t.begin(); }
326 end() const _GLIBCXX_NOEXCEPT
327 {
return _M_t.end(); }
336 {
return _M_t.rbegin(); }
345 {
return _M_t.rend(); }
347 #if __cplusplus >= 201103L 355 {
return _M_t.begin(); }
364 {
return _M_t.end(); }
373 {
return _M_t.rbegin(); }
382 {
return _M_t.rend(); }
388 {
return _M_t.empty(); }
393 {
return _M_t.size(); }
398 {
return _M_t.max_size(); }
413 #if __cplusplus >= 201103L 414 noexcept(_Alloc_traits::_S_nothrow_swap())
416 { _M_t.swap(__x._M_t); }
419 #if __cplusplus >= 201103L 433 template<
typename... _Args>
436 {
return _M_t._M_emplace_unique(std::forward<_Args>(__args)...); }
459 template<
typename... _Args>
463 return _M_t._M_emplace_hint_unique(__pos,
464 std::forward<_Args>(__args)...);
485 _M_t._M_insert_unique(__x);
489 #if __cplusplus >= 201103L 494 _M_t._M_insert_unique(std::move(__x));
519 insert(const_iterator __position,
const value_type& __x)
520 {
return _M_t._M_insert_unique_(__position, __x); }
522 #if __cplusplus >= 201103L 524 insert(const_iterator __position, value_type&& __x)
525 {
return _M_t._M_insert_unique_(__position, std::move(__x)); }
537 template<
typename _InputIterator>
539 insert(_InputIterator __first, _InputIterator __last)
540 { _M_t._M_insert_unique(__first, __last); }
542 #if __cplusplus >= 201103L 552 { this->
insert(__l.begin(), __l.end()); }
555 #if __cplusplus >= 201103L 571 _GLIBCXX_ABI_TAG_CXX11
574 {
return _M_t.erase(__position); }
587 erase(iterator __position)
588 { _M_t.erase(__position); }
604 {
return _M_t.erase(__x); }
606 #if __cplusplus >= 201103L 623 _GLIBCXX_ABI_TAG_CXX11
625 erase(const_iterator __first, const_iterator __last)
626 {
return _M_t.erase(__first, __last); }
641 erase(iterator __first, iterator __last)
642 { _M_t.erase(__first, __last); }
668 {
return _M_t.find(__x) == _M_t.end() ? 0 : 1; }
670 #if __cplusplus > 201103L 671 template<
typename _Kt>
674 -> decltype(_M_t._M_count_tr(__x))
675 {
return _M_t._M_find_tr(__x) == _M_t.end() ? 0 : 1; }
695 {
return _M_t.find(__x); }
698 find(
const key_type& __x)
const 699 {
return _M_t.find(__x); }
701 #if __cplusplus > 201103L 702 template<
typename _Kt>
705 -> decltype(iterator{_M_t._M_find_tr(__x)})
706 {
return iterator{_M_t._M_find_tr(__x)}; }
708 template<
typename _Kt>
711 -> decltype(const_iterator{_M_t._M_find_tr(__x)})
712 {
return const_iterator{_M_t._M_find_tr(__x)}; }
730 {
return _M_t.lower_bound(__x); }
734 {
return _M_t.lower_bound(__x); }
736 #if __cplusplus > 201103L 737 template<
typename _Kt>
740 -> decltype(_M_t._M_lower_bound_tr(__x))
741 {
return _M_t._M_lower_bound_tr(__x); }
743 template<
typename _Kt>
746 -> decltype(_M_t._M_lower_bound_tr(__x))
747 {
return _M_t._M_lower_bound_tr(__x); }
760 {
return _M_t.upper_bound(__x); }
764 {
return _M_t.upper_bound(__x); }
766 #if __cplusplus > 201103L 767 template<
typename _Kt>
770 -> decltype(_M_t._M_upper_bound_tr(__x))
771 {
return _M_t._M_upper_bound_tr(__x); }
773 template<
typename _Kt>
776 -> decltype(_M_t._M_upper_bound_tr(__x))
777 {
return _M_t._M_upper_bound_tr(__x); }
799 {
return _M_t.equal_range(__x); }
803 {
return _M_t.equal_range(__x); }
805 #if __cplusplus > 201103L 806 template<
typename _Kt>
809 -> decltype(_M_t._M_equal_range_tr(__x))
810 {
return _M_t._M_equal_range_tr(__x); }
812 template<
typename _Kt>
815 -> decltype(_M_t._M_equal_range_tr(__x))
816 {
return _M_t._M_equal_range_tr(__x); }
820 template<
typename _K1,
typename _C1,
typename _A1>
824 template<
typename _K1,
typename _C1,
typename _A1>
840 template<
typename _Key,
typename _Compare,
typename _Alloc>
844 {
return __x._M_t == __y._M_t; }
857 template<
typename _Key,
typename _Compare,
typename _Alloc>
859 operator<(const set<_Key, _Compare, _Alloc>& __x,
861 {
return __x._M_t < __y._M_t; }
864 template<
typename _Key,
typename _Compare,
typename _Alloc>
868 {
return !(__x == __y); }
871 template<
typename _Key,
typename _Compare,
typename _Alloc>
875 {
return __y < __x; }
878 template<
typename _Key,
typename _Compare,
typename _Alloc>
880 operator<=(const set<_Key, _Compare, _Alloc>& __x,
882 {
return !(__y < __x); }
885 template<
typename _Key,
typename _Compare,
typename _Alloc>
889 {
return !(__x < __y); }
892 template<
typename _Key,
typename _Compare,
typename _Alloc>
897 _GLIBCXX_END_NAMESPACE_CONTAINER
auto lower_bound(const _Kt &__x) -> decltype(_M_t._M_lower_bound_tr(__x))
Finds the beginning of a subsequence matching given key.
bool empty() const noexcept
Returns true if the set is empty.
iterator cend() const noexcept
size_type count(const key_type &__x) const
Finds the number of elements.
_Key key_type
Public typedefs.
size_type size() const noexcept
Returns the size of the set.
_Alloc_traits::const_reference const_reference
Iterator-related typedefs.
_Key value_type
Public typedefs.
_Compare key_compare
Public typedefs.
iterator begin() const noexcept
_Rep_type::difference_type difference_type
Iterator-related typedefs.
_Alloc_traits::const_pointer const_pointer
Iterator-related typedefs.
reverse_iterator crbegin() const noexcept
reverse_iterator rend() const noexcept
key_compare key_comp() const
Returns the comparison object with which the set was constructed.
void insert(initializer_list< value_type > __l)
Attempts to insert a list of elements into the set.
_Rep_type::const_reverse_iterator reverse_iterator
Iterator-related typedefs.
A standard container made up of unique keys, which can be retrieved in logarithmic time...
_Rep_type::const_iterator const_iterator
Iterator-related typedefs.
_Compare value_compare
Public typedefs.
_GLIBCXX_ABI_TAG_CXX11 iterator erase(const_iterator __position)
Erases an element from a set.
void swap(set &__x) noexcept(_Alloc_traits::_S_nothrow_swap())
Swaps data with another set.
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key.
_Alloc_traits::reference reference
Iterator-related typedefs.
allocator_type get_allocator() const noexcept
Returns the allocator object with which the set was constructed.
_GLIBCXX_ABI_TAG_CXX11 iterator erase(const_iterator __first, const_iterator __last)
Erases a [__first,__last) range of elements from a set.
iterator lower_bound(const key_type &__x)
Finds the beginning of a subsequence matching given key.
iterator find(const key_type &__x)
Tries to locate an element in a set.
std::pair< const_iterator, const_iterator > equal_range(const key_type &__x) const
Finds a subsequence matching given key.
auto upper_bound(const _Kt &__x) const -> decltype(_M_t._M_upper_bound_tr(__x))
Finds the end of a subsequence matching given key.
reverse_iterator rbegin() const noexcept
auto lower_bound(const _Kt &__x) const -> decltype(_M_t._M_lower_bound_tr(__x))
Finds the beginning of a subsequence matching given key.
iterator emplace_hint(const_iterator __pos, _Args &&...__args)
Attempts to insert an element into the set.
auto find(const _Kt &__x) const -> decltype(const_iterator
Tries to locate an element in a set.
size_type erase(const key_type &__x)
Erases elements according to the provided key.
size_type max_size() const noexcept
Returns the maximum size of the set.
_Alloc allocator_type
Public typedefs.
std::pair< iterator, bool > emplace(_Args &&...__args)
Attempts to build and insert an element into the set.
auto count(const _Kt &__x) const -> decltype(_M_t._M_count_tr(__x))
Finds the number of elements.
set & operator=(const set &__x)
Set assignment operator.
value_compare value_comp() const
Returns the comparison object with which the set was constructed.
_Rep_type::const_reverse_iterator const_reverse_iterator
Iterator-related typedefs.
iterator cbegin() const noexcept
_T2 second
first is a copy of the first object
auto upper_bound(const _Kt &__x) -> decltype(_M_t._M_upper_bound_tr(__x))
Finds the end of a subsequence matching given key.
iterator insert(const_iterator __position, const value_type &__x)
Attempts to insert an element into the set.
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.
Struct holding two objects of arbitrary type.
set & operator=(initializer_list< value_type > __l)
Set list assignment operator.
_T1 first
second_type is the second bound type
auto equal_range(const _Kt &__x) const -> decltype(_M_t._M_equal_range_tr(__x))
Finds a subsequence matching given key.
ISO C++ entities toplevel namespace is std.
const_iterator upper_bound(const key_type &__x) const
Finds the end of a subsequence matching given key.
Uniform interface to C++98 and C++0x allocators.
_Rep_type::size_type size_type
Iterator-related typedefs.
auto equal_range(const _Kt &__x) -> decltype(_M_t._M_equal_range_tr(__x))
Finds a subsequence matching given key.
std::pair< iterator, bool > insert(const value_type &__x)
Attempts to insert an element into the set.
iterator end() const noexcept
_Rep_type::const_iterator iterator
Iterator-related typedefs.
reverse_iterator crend() const noexcept
iterator upper_bound(const key_type &__x)
Finds the end of a subsequence matching given key.
_Alloc_traits::pointer pointer
Iterator-related typedefs.
const_iterator find(const key_type &__x) const
Tries to locate an element in a set.
void insert(_InputIterator __first, _InputIterator __last)
A template function that attempts to insert a range of elements.