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
145 && is_nothrow_default_constructible<key_compare>::value)
155 set(
const _Compare& __comp,
157 : _M_t(__comp, _Key_alloc_type(__a)) { }
169 template<
typename _InputIterator>
170 set(_InputIterator __first, _InputIterator __last)
172 { _M_t._M_insert_unique(__first, __last); }
186 template<
typename _InputIterator>
187 set(_InputIterator __first, _InputIterator __last,
188 const _Compare& __comp,
190 : _M_t(__comp, _Key_alloc_type(__a))
191 { _M_t._M_insert_unique(__first, __last); }
203 #if __cplusplus >= 201103L 212 noexcept(is_nothrow_copy_constructible<_Compare>::value)
213 : _M_t(std::move(__x._M_t)) { }
226 const _Compare& __comp = _Compare(),
228 : _M_t(__comp, _Key_alloc_type(__a))
229 { _M_t._M_insert_unique(__l.begin(), __l.end()); }
233 set(
const allocator_type& __a)
234 : _M_t(_Compare(), _Key_alloc_type(__a)) { }
237 set(
const set& __x,
const allocator_type& __a)
238 : _M_t(__x._M_t, _Key_alloc_type(__a)) { }
241 set(
set&& __x,
const allocator_type& __a)
242 noexcept(is_nothrow_copy_constructible<_Compare>::value
243 && _Alloc_traits::_S_always_equal())
244 : _M_t(std::move(__x._M_t), _Key_alloc_type(__a)) { }
248 : _M_t(_Compare(), _Key_alloc_type(__a))
249 { _M_t._M_insert_unique(__l.begin(), __l.end()); }
252 template<
typename _InputIterator>
253 set(_InputIterator __first, _InputIterator __last,
254 const allocator_type& __a)
255 : _M_t(_Compare(), _Key_alloc_type(__a))
256 { _M_t._M_insert_unique(__first, __last); }
273 #if __cplusplus >= 201103L 292 _M_t._M_assign_unique(__l.begin(), __l.end());
302 {
return _M_t.key_comp(); }
306 {
return _M_t.key_comp(); }
319 {
return _M_t.begin(); }
327 end() const _GLIBCXX_NOEXCEPT
328 {
return _M_t.end(); }
337 {
return _M_t.rbegin(); }
346 {
return _M_t.rend(); }
348 #if __cplusplus >= 201103L 356 {
return _M_t.begin(); }
365 {
return _M_t.end(); }
374 {
return _M_t.rbegin(); }
383 {
return _M_t.rend(); }
389 {
return _M_t.empty(); }
394 {
return _M_t.size(); }
399 {
return _M_t.max_size(); }
414 #if __cplusplus >= 201103L 415 noexcept(_Alloc_traits::_S_nothrow_swap())
417 { _M_t.swap(__x._M_t); }
420 #if __cplusplus >= 201103L 434 template<
typename... _Args>
437 {
return _M_t._M_emplace_unique(std::forward<_Args>(__args)...); }
460 template<
typename... _Args>
464 return _M_t._M_emplace_hint_unique(__pos,
465 std::forward<_Args>(__args)...);
486 _M_t._M_insert_unique(__x);
490 #if __cplusplus >= 201103L 495 _M_t._M_insert_unique(std::move(__x));
520 insert(const_iterator __position,
const value_type& __x)
521 {
return _M_t._M_insert_unique_(__position, __x); }
523 #if __cplusplus >= 201103L 525 insert(const_iterator __position, value_type&& __x)
526 {
return _M_t._M_insert_unique_(__position, std::move(__x)); }
538 template<
typename _InputIterator>
540 insert(_InputIterator __first, _InputIterator __last)
541 { _M_t._M_insert_unique(__first, __last); }
543 #if __cplusplus >= 201103L 553 { this->
insert(__l.begin(), __l.end()); }
556 #if __cplusplus >= 201103L 572 _GLIBCXX_ABI_TAG_CXX11
575 {
return _M_t.erase(__position); }
588 erase(iterator __position)
589 { _M_t.erase(__position); }
605 {
return _M_t.erase(__x); }
607 #if __cplusplus >= 201103L 624 _GLIBCXX_ABI_TAG_CXX11
626 erase(const_iterator __first, const_iterator __last)
627 {
return _M_t.erase(__first, __last); }
642 erase(iterator __first, iterator __last)
643 { _M_t.erase(__first, __last); }
669 {
return _M_t.find(__x) == _M_t.end() ? 0 : 1; }
671 #if __cplusplus > 201103L 672 template<
typename _Kt>
675 -> decltype(_M_t._M_count_tr(__x))
676 {
return _M_t._M_count_tr(__x); }
696 {
return _M_t.find(__x); }
699 find(
const key_type& __x)
const 700 {
return _M_t.find(__x); }
702 #if __cplusplus > 201103L 703 template<
typename _Kt>
706 -> decltype(iterator{_M_t._M_find_tr(__x)})
707 {
return iterator{_M_t._M_find_tr(__x)}; }
709 template<
typename _Kt>
712 -> decltype(const_iterator{_M_t._M_find_tr(__x)})
713 {
return const_iterator{_M_t._M_find_tr(__x)}; }
731 {
return _M_t.lower_bound(__x); }
735 {
return _M_t.lower_bound(__x); }
737 #if __cplusplus > 201103L 738 template<
typename _Kt>
741 -> decltype(
iterator(_M_t._M_lower_bound_tr(__x)))
742 {
return iterator(_M_t._M_lower_bound_tr(__x)); }
744 template<
typename _Kt>
761 {
return _M_t.upper_bound(__x); }
765 {
return _M_t.upper_bound(__x); }
767 #if __cplusplus > 201103L 768 template<
typename _Kt>
771 -> decltype(
iterator(_M_t._M_upper_bound_tr(__x)))
772 {
return iterator(_M_t._M_upper_bound_tr(__x)); }
774 template<
typename _Kt>
777 -> decltype(
iterator(_M_t._M_upper_bound_tr(__x)))
800 {
return _M_t.equal_range(__x); }
804 {
return _M_t.equal_range(__x); }
806 #if __cplusplus > 201103L 807 template<
typename _Kt>
813 template<
typename _Kt>
821 template<
typename _K1,
typename _C1,
typename _A1>
825 template<
typename _K1,
typename _C1,
typename _A1>
841 template<
typename _Key,
typename _Compare,
typename _Alloc>
845 {
return __x._M_t == __y._M_t; }
858 template<
typename _Key,
typename _Compare,
typename _Alloc>
860 operator<(const set<_Key, _Compare, _Alloc>& __x,
862 {
return __x._M_t < __y._M_t; }
865 template<
typename _Key,
typename _Compare,
typename _Alloc>
869 {
return !(__x == __y); }
872 template<
typename _Key,
typename _Compare,
typename _Alloc>
876 {
return __y < __x; }
879 template<
typename _Key,
typename _Compare,
typename _Alloc>
881 operator<=(const set<_Key, _Compare, _Alloc>& __x,
883 {
return !(__y < __x); }
886 template<
typename _Key,
typename _Compare,
typename _Alloc>
890 {
return !(__x < __y); }
893 template<
typename _Key,
typename _Compare,
typename _Alloc>
898 _GLIBCXX_END_NAMESPACE_CONTAINER
_Rep_type::size_type size_type
Iterator-related typedefs.
reverse_iterator crend() const noexcept
reverse_iterator crbegin() const noexcept
auto find(const _Kt &__x) const -> decltype(const_iterator
Tries to locate an element in a set.
_Alloc_traits::reference reference
Iterator-related typedefs.
iterator cbegin() const noexcept
_Key key_type
Public typedefs.
void swap(set &__x) noexcept(_Alloc_traits::_S_nothrow_swap())
Swaps data with another set.
iterator begin() const noexcept
size_type max_size() const noexcept
Returns the maximum size of the set.
void insert(_InputIterator __first, _InputIterator __last)
A template function that attempts to insert a range of elements.
size_type erase(const key_type &__x)
Erases elements according to the provided key.
std::pair< const_iterator, const_iterator > equal_range(const key_type &__x) const
Finds a subsequence matching given key.
size_type count(const key_type &__x) const
Finds the number of elements.
set & operator=(const set &__x)
Set assignment operator.
_Compare value_compare
Public typedefs.
std::pair< iterator, bool > insert(const value_type &__x)
Attempts to insert an element into the set.
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key.
_Rep_type::const_iterator const_iterator
Iterator-related typedefs.
iterator emplace_hint(const_iterator __pos, _Args &&... __args)
Attempts to insert an element into the set.
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.
_T2 second
first is a copy of the first object
auto equal_range(const _Kt &__x) const -> decltype(pair< iterator, iterator >(_M_t._M_equal_range_tr(__x)))
Finds a subsequence matching given key.
_Rep_type::const_reverse_iterator reverse_iterator
Iterator-related typedefs.
reverse_iterator rend() const noexcept
Uniform interface to C++98 and C++0x allocators.
ISO C++ entities toplevel namespace is std.
auto count(const _Kt &__x) const -> decltype(_M_t._M_count_tr(__x))
Finds the number of elements.
set & operator=(initializer_list< value_type > __l)
Set list assignment operator.
_Rep_type::difference_type difference_type
Iterator-related typedefs.
iterator insert(const_iterator __position, const value_type &__x)
Attempts to insert an element into the set.
allocator_type get_allocator() const noexcept
Returns the allocator object with which the set was constructed.
A standard container made up of unique keys, which can be retrieved in logarithmic time...
const_iterator lower_bound(const key_type &__x) const
Finds the beginning of a subsequence matching given key.
_Rep_type::const_reverse_iterator const_reverse_iterator
Iterator-related typedefs.
iterator lower_bound(const key_type &__x)
Finds the beginning of a subsequence matching given key.
iterator upper_bound(const key_type &__x)
Finds the end of a subsequence matching given key.
size_type size() const noexcept
Returns the size of the set.
iterator cend() const noexcept
value_compare value_comp() const
Returns the comparison object with which the set was constructed.
iterator end() const noexcept
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.
iterator find(const key_type &__x)
Tries to locate an element in a set.
Struct holding two objects of arbitrary type.
key_compare key_comp() const
Returns the comparison object with which the set was constructed.
_Rep_type::const_iterator iterator
Iterator-related typedefs.
const_iterator find(const key_type &__x) const
Tries to locate an element in a set.
auto find(const _Kt &__x) -> decltype(iterator
Tries to locate an element in a set.
void insert(initializer_list< value_type > __l)
Attempts to insert a list of elements 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_pointer const_pointer
Iterator-related typedefs.
bool empty() const noexcept
Returns true if the set is empty.
const_iterator upper_bound(const key_type &__x) const
Finds the end of a subsequence matching given key.
_Alloc_traits::pointer pointer
Iterator-related typedefs.
auto upper_bound(const _Kt &__x) -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
Finds the end of a subsequence matching given key.
_Alloc allocator_type
Public typedefs.
reverse_iterator rbegin() const noexcept
auto equal_range(const _Kt &__x) -> decltype(pair< iterator, iterator >(_M_t._M_equal_range_tr(__x)))
Finds a subsequence matching given key.
_GLIBCXX_ABI_TAG_CXX11 iterator erase(const_iterator __position)
Erases an element from a set.
auto lower_bound(const _Kt &__x) -> decltype(iterator(_M_t._M_lower_bound_tr(__x)))
Finds the beginning of a subsequence matching given key.
_Compare key_compare
Public typedefs.
_Alloc_traits::const_reference const_reference
Iterator-related typedefs.
_T1 first
second_type is the second bound type
_Key value_type
Public typedefs.
std::pair< iterator, bool > emplace(_Args &&... __args)
Attempts to build and insert an element into the set.