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;
151 set(
const _Compare& __comp,
153 : _M_t(__comp, _Key_alloc_type(__a)) { }
165 template<
typename _InputIterator>
166 set(_InputIterator __first, _InputIterator __last)
168 { _M_t._M_insert_unique(__first, __last); }
182 template<
typename _InputIterator>
183 set(_InputIterator __first, _InputIterator __last,
184 const _Compare& __comp,
186 : _M_t(__comp, _Key_alloc_type(__a))
187 { _M_t._M_insert_unique(__first, __last); }
199 #if __cplusplus >= 201103L
208 noexcept(is_nothrow_copy_constructible<_Compare>::value)
209 : _M_t(std::move(__x._M_t)) { }
222 const _Compare& __comp = _Compare(),
224 : _M_t(__comp, _Key_alloc_type(__a))
225 { _M_t._M_insert_unique(__l.begin(), __l.end()); }
230 : _M_t(_Compare(), _Key_alloc_type(__a)) { }
234 : _M_t(__x._M_t, _Key_alloc_type(__a)) { }
238 noexcept(is_nothrow_copy_constructible<_Compare>::value
240 : _M_t(std::move(__x._M_t), _Key_alloc_type(__a)) { }
244 : _M_t(_Compare(), _Key_alloc_type(__a))
245 { _M_t._M_insert_unique(__l.begin(), __l.end()); }
248 template<
typename _InputIterator>
249 set(_InputIterator __first, _InputIterator __last,
251 : _M_t(_Compare(), _Key_alloc_type(__a))
252 { _M_t._M_insert_unique(__first, __last); }
269 #if __cplusplus >= 201103L
280 if (!_M_t._M_move_assign(__x._M_t))
285 insert(std::__make_move_if_noexcept_iterator(__x._M_t.begin()),
286 std::__make_move_if_noexcept_iterator(__x._M_t.end()));
307 this->
insert(__l.begin(), __l.end());
317 {
return _M_t.key_comp(); }
321 {
return _M_t.key_comp(); }
334 {
return _M_t.begin(); }
342 end() const _GLIBCXX_NOEXCEPT
343 {
return _M_t.end(); }
352 {
return _M_t.rbegin(); }
361 {
return _M_t.rend(); }
363 #if __cplusplus >= 201103L
371 {
return _M_t.begin(); }
380 {
return _M_t.end(); }
389 {
return _M_t.rbegin(); }
398 {
return _M_t.rend(); }
404 {
return _M_t.empty(); }
409 {
return _M_t.size(); }
414 {
return _M_t.max_size(); }
429 #if __cplusplus >= 201103L
430 noexcept(_Alloc_traits::_S_nothrow_swap())
432 { _M_t.swap(__x._M_t); }
435 #if __cplusplus >= 201103L
449 template<
typename... _Args>
452 {
return _M_t._M_emplace_unique(std::forward<_Args>(__args)...); }
475 template<
typename... _Args>
479 return _M_t._M_emplace_hint_unique(__pos,
480 std::forward<_Args>(__args)...);
501 _M_t._M_insert_unique(__x);
505 #if __cplusplus >= 201103L
510 _M_t._M_insert_unique(std::move(__x));
536 {
return _M_t._M_insert_unique_(__position, __x); }
538 #if __cplusplus >= 201103L
541 {
return _M_t._M_insert_unique_(__position, std::move(__x)); }
553 template<
typename _InputIterator>
555 insert(_InputIterator __first, _InputIterator __last)
556 { _M_t._M_insert_unique(__first, __last); }
558 #if __cplusplus >= 201103L
568 { this->
insert(__l.begin(), __l.end()); }
571 #if __cplusplus >= 201103L
587 _GLIBCXX_ABI_TAG_CXX11
590 {
return _M_t.erase(__position); }
604 { _M_t.erase(__position); }
620 {
return _M_t.erase(__x); }
622 #if __cplusplus >= 201103L
639 _GLIBCXX_ABI_TAG_CXX11
642 {
return _M_t.erase(__first, __last); }
658 { _M_t.erase(__first, __last); }
683 {
return _M_t.find(__x) == _M_t.end() ? 0 : 1; }
701 {
return _M_t.find(__x); }
705 {
return _M_t.find(__x); }
722 {
return _M_t.lower_bound(__x); }
726 {
return _M_t.lower_bound(__x); }
738 {
return _M_t.upper_bound(__x); }
742 {
return _M_t.upper_bound(__x); }
763 {
return _M_t.equal_range(__x); }
767 {
return _M_t.equal_range(__x); }
770 template<
typename _K1,
typename _C1,
typename _A1>
774 template<
typename _K1,
typename _C1,
typename _A1>
790 template<
typename _Key,
typename _Compare,
typename _Alloc>
794 {
return __x._M_t == __y._M_t; }
807 template<
typename _Key,
typename _Compare,
typename _Alloc>
809 operator<(const set<_Key, _Compare, _Alloc>& __x,
811 {
return __x._M_t < __y._M_t; }
814 template<
typename _Key,
typename _Compare,
typename _Alloc>
818 {
return !(__x == __y); }
821 template<
typename _Key,
typename _Compare,
typename _Alloc>
825 {
return __y < __x; }
828 template<
typename _Key,
typename _Compare,
typename _Alloc>
830 operator<=(const set<_Key, _Compare, _Alloc>& __x,
832 {
return !(__y < __x); }
835 template<
typename _Key,
typename _Compare,
typename _Alloc>
839 {
return !(__x < __y); }
842 template<
typename _Key,
typename _Compare,
typename _Alloc>
847 _GLIBCXX_END_NAMESPACE_CONTAINER
_Alloc_traits::pointer pointer
Iterator-related typedefs.
set(const allocator_type &__a)
Allocator-extended default constructor.
_Alloc_traits::const_pointer const_pointer
Iterator-related typedefs.
const_iterator find(const key_type &__x) const
Tries to locate an element in a set.
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 __position)
Erases an element from a set.
set(const set &__x, const allocator_type &__a)
Allocator-extended copy constructor.
_Key key_type
Public typedefs.
size_type count(const key_type &__x) const
Finds the number of elements.
_T2 second
first is a copy of the first object
set()
Default constructor creates no elements.
set(const _Compare &__comp, const allocator_type &__a=allocator_type())
Creates a set with no elements.
Uniform interface to C++98 and C++0x allocators.
set & operator=(const set &__x)
Set assignment operator.
reverse_iterator crend() const noexcept
reverse_iterator rbegin() const noexcept
set & operator=(initializer_list< value_type > __l)
Set list assignment operator.
_Rep_type::const_iterator iterator
Iterator-related typedefs.
_Compare value_compare
Public typedefs.
_T1 first
second_type is the second bound type
size_type max_size() const noexcept
Returns the maximum size of the set.
_Compare key_compare
Public typedefs.
_Alloc allocator_type
Public typedefs.
Struct holding two objects of arbitrary type.
_Rep_type::const_iterator const_iterator
Iterator-related typedefs.
noexcept(is_nothrow_copy_constructible< _Compare >::value)
Set move constructor
iterator find(const key_type &__x)
Tries to locate an element in a set.
_Alloc_traits::reference reference
Iterator-related typedefs.
std::pair< iterator, bool > emplace(_Args &&...__args)
Attempts to build and insert an element into the set.
set(initializer_list< value_type > __l, const _Compare &__comp=_Compare(), const allocator_type &__a=allocator_type())
Builds a set from an initializer_list.
bool empty() const noexcept
Returns true if the set is empty.
iterator cend() const noexcept
size_type erase(const key_type &__x)
Erases elements according to the provided key.
size_type size() const noexcept
Returns the size of the set.
reverse_iterator rend() const noexcept
set(initializer_list< value_type > __l, const allocator_type &__a)
Allocator-extended initialier-list constructor.
key_compare key_comp() const
Returns the comparison object with which the set was constructed.
iterator upper_bound(const key_type &__x)
Finds the end of a subsequence matching given key.
std::pair< iterator, bool > insert(const value_type &__x)
Attempts to insert an element into the set.
set(_InputIterator __first, _InputIterator __last)
Builds a set from a range.
iterator cbegin() const noexcept
allocator_type get_allocator() const noexcept
Returns the allocator object with which the set was constructed.
_Alloc_traits::const_reference const_reference
Iterator-related typedefs.
set(_InputIterator __first, _InputIterator __last, const allocator_type &__a)
Allocator-extended range constructor.
_Rep_type::difference_type difference_type
Iterator-related typedefs.
_Rep_type::const_reverse_iterator const_reverse_iterator
Iterator-related typedefs.
set(_InputIterator __first, _InputIterator __last, const _Compare &__comp, const allocator_type &__a=allocator_type())
Builds a set from a range.
iterator begin() const noexcept
set(const set &__x)
Set copy constructor.
const_iterator upper_bound(const key_type &__x) const
Finds the end of a subsequence matching given key.
_Key value_type
Public typedefs.
_Rep_type::const_reverse_iterator reverse_iterator
Iterator-related typedefs.
iterator lower_bound(const key_type &__x)
Finds the beginning of a subsequence matching given key.
iterator end() const noexcept
reverse_iterator crbegin() const noexcept
The standard allocator, as per [20.4].
void swap(function< _Res(_Args...)> &__x, function< _Res(_Args...)> &__y)
Swap the targets of two polymorphic function object wrappers.
value_compare value_comp() const
Returns the comparison object with which the set was constructed.
iterator emplace_hint(const_iterator __pos, _Args &&...__args)
Attempts to insert an element into the set.
const_iterator lower_bound(const key_type &__x) const
Finds the beginning of a subsequence matching given key.
set & operator=(set &&__x) noexcept(_Alloc_traits::_S_nothrow_move())
Set move assignment operator.
_GLIBCXX_ABI_TAG_CXX11 iterator erase(const_iterator __first, const_iterator __last)
Erases a [__first,__last) range of elements from a set.
void insert(_InputIterator __first, _InputIterator __last)
A template function that attempts to insert a range of elements.
std::pair< const_iterator, const_iterator > equal_range(const key_type &__x) const
Finds a subsequence matching given key.
_Rep_type::size_type size_type
Iterator-related typedefs.
A standard container made up of unique keys, which can be retrieved in logarithmic time...
void insert(initializer_list< value_type > __l)
Attempts to insert a list of elements into the set.
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key.