60 #if __cplusplus >= 201103L
61 #include <initializer_list>
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)) { }
221 set(initializer_list<value_type> __l,
222 const _Compare& __comp = _Compare(),
224 : _M_t(__comp, _Key_alloc_type(__a))
225 { _M_t._M_insert_unique(__l.begin(), __l.end()); }
229 set(
const allocator_type& __a)
230 : _M_t(_Compare(), _Key_alloc_type(__a)) { }
233 set(
const set& __x,
const allocator_type& __a)
234 : _M_t(__x._M_t, _Key_alloc_type(__a)) { }
237 set(
set&& __x,
const allocator_type& __a)
238 noexcept(is_nothrow_copy_constructible<_Compare>::value
239 && _Alloc_traits::_S_always_equal())
240 : _M_t(
std::
move(__x._M_t), _Key_alloc_type(__a)) { }
243 set(initializer_list<value_type> __l,
const allocator_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,
250 const allocator_type& __a)
251 : _M_t(_Compare(), _Key_alloc_type(__a))
252 { _M_t._M_insert_unique(__first, __last); }
269 #if __cplusplus >= 201103L
288 _M_t._M_assign_unique(__l.begin(), __l.end());
298 {
return _M_t.key_comp(); }
302 {
return _M_t.key_comp(); }
315 {
return _M_t.begin(); }
323 end() const _GLIBCXX_NOEXCEPT
324 {
return _M_t.end(); }
333 {
return _M_t.rbegin(); }
342 {
return _M_t.rend(); }
344 #if __cplusplus >= 201103L
352 {
return _M_t.begin(); }
361 {
return _M_t.end(); }
370 {
return _M_t.rbegin(); }
379 {
return _M_t.rend(); }
385 {
return _M_t.empty(); }
390 {
return _M_t.size(); }
395 {
return _M_t.max_size(); }
410 #if __cplusplus >= 201103L
411 noexcept(_Alloc_traits::_S_nothrow_swap())
413 { _M_t.swap(__x._M_t); }
416 #if __cplusplus >= 201103L
430 template<
typename... _Args>
433 {
return _M_t._M_emplace_unique(std::forward<_Args>(__args)...); }
456 template<
typename... _Args>
460 return _M_t._M_emplace_hint_unique(__pos,
461 std::forward<_Args>(__args)...);
482 _M_t._M_insert_unique(__x);
486 #if __cplusplus >= 201103L
516 insert(const_iterator __position,
const value_type& __x)
517 {
return _M_t._M_insert_unique_(__position, __x); }
519 #if __cplusplus >= 201103L
521 insert(const_iterator __position, value_type&& __x)
522 {
return _M_t._M_insert_unique_(__position,
std::move(__x)); }
534 template<
typename _InputIterator>
536 insert(_InputIterator __first, _InputIterator __last)
537 { _M_t._M_insert_unique(__first, __last); }
539 #if __cplusplus >= 201103L
549 { this->
insert(__l.begin(), __l.end()); }
552 #if __cplusplus >= 201103L
568 _GLIBCXX_ABI_TAG_CXX11
571 {
return _M_t.erase(__position); }
584 erase(iterator __position)
585 { _M_t.erase(__position); }
601 {
return _M_t.erase(__x); }
603 #if __cplusplus >= 201103L
620 _GLIBCXX_ABI_TAG_CXX11
622 erase(const_iterator __first, const_iterator __last)
623 {
return _M_t.erase(__first, __last); }
638 erase(iterator __first, iterator __last)
639 { _M_t.erase(__first, __last); }
665 {
return _M_t.find(__x) == _M_t.end() ? 0 : 1; }
667 #if __cplusplus > 201103L
668 template<
typename _Kt>
670 count(
const _Kt& __x)
const
671 -> decltype(_M_t._M_count_tr(__x))
672 {
return _M_t._M_find_tr(__x) == _M_t.end() ? 0 : 1; }
692 {
return _M_t.find(__x); }
695 find(
const key_type& __x)
const
696 {
return _M_t.find(__x); }
698 #if __cplusplus > 201103L
699 template<
typename _Kt>
701 find(
const _Kt& __x) -> decltype(_M_t._M_find_tr(__x))
702 {
return _M_t._M_find_tr(__x); }
704 template<
typename _Kt>
706 find(
const _Kt& __x)
const -> decltype(_M_t._M_find_tr(__x))
707 {
return _M_t._M_find_tr(__x); }
725 {
return _M_t.lower_bound(__x); }
729 {
return _M_t.lower_bound(__x); }
731 #if __cplusplus > 201103L
732 template<
typename _Kt>
735 -> decltype(_M_t._M_lower_bound_tr(__x))
736 {
return _M_t._M_lower_bound_tr(__x); }
738 template<
typename _Kt>
741 -> decltype(_M_t._M_lower_bound_tr(__x))
742 {
return _M_t._M_lower_bound_tr(__x); }
755 {
return _M_t.upper_bound(__x); }
759 {
return _M_t.upper_bound(__x); }
761 #if __cplusplus > 201103L
762 template<
typename _Kt>
765 -> decltype(_M_t._M_upper_bound_tr(__x))
766 {
return _M_t._M_upper_bound_tr(__x); }
768 template<
typename _Kt>
771 -> decltype(_M_t._M_upper_bound_tr(__x))
772 {
return _M_t._M_upper_bound_tr(__x); }
794 {
return _M_t.equal_range(__x); }
798 {
return _M_t.equal_range(__x); }
800 #if __cplusplus > 201103L
801 template<
typename _Kt>
804 -> decltype(_M_t._M_equal_range_tr(__x))
805 {
return _M_t._M_equal_range_tr(__x); }
807 template<
typename _Kt>
810 -> decltype(_M_t._M_equal_range_tr(__x))
811 {
return _M_t._M_equal_range_tr(__x); }
815 template<
typename _K1,
typename _C1,
typename _A1>
817 operator==(
const set<_K1, _C1, _A1>&,
const set<_K1, _C1, _A1>&);
819 template<
typename _K1,
typename _C1,
typename _A1>
821 operator<(const set<_K1, _C1, _A1>&,
const set<_K1, _C1, _A1>&);
835 template<
typename _Key,
typename _Compare,
typename _Alloc>
839 {
return __x._M_t == __y._M_t; }
852 template<
typename _Key,
typename _Compare,
typename _Alloc>
854 operator<(const set<_Key, _Compare, _Alloc>& __x,
856 {
return __x._M_t < __y._M_t; }
859 template<
typename _Key,
typename _Compare,
typename _Alloc>
863 {
return !(__x == __y); }
866 template<
typename _Key,
typename _Compare,
typename _Alloc>
870 {
return __y < __x; }
873 template<
typename _Key,
typename _Compare,
typename _Alloc>
875 operator<=(const set<_Key, _Compare, _Alloc>& __x,
877 {
return !(__y < __x); }
880 template<
typename _Key,
typename _Compare,
typename _Alloc>
884 {
return !(__x < __y); }
887 template<
typename _Key,
typename _Compare,
typename _Alloc>
892 _GLIBCXX_END_NAMESPACE_CONTAINER
void swap(_Tp &, _Tp &) noexcept(__and_< is_nothrow_move_constructible< _Tp >, is_nothrow_move_assignable< _Tp >>::value)
Swaps two values.
iterator cbegin() const noexcept
const_iterator lower_bound(const key_type &__x) const
Finds the beginning of a subsequence matching given key.
_GLIBCXX_ABI_TAG_CXX11 iterator erase(const_iterator __position)
Erases an element from a set.
set(_InputIterator __first, _InputIterator __last)
Builds a set from a range.
set(const allocator_type &__a)
Allocator-extended default constructor.
size_type size() const noexcept
Returns the size of the set.
_Alloc_traits::const_reference const_reference
Iterator-related typedefs.
reverse_iterator rend() const noexcept
size_type max_size() const noexcept
Returns the maximum size of the set.
set(initializer_list< value_type > __l, const allocator_type &__a)
Allocator-extended initialier-list constructor.
Uniform interface to C++98 and C++0x allocators.
_Key value_type
Public typedefs.
set & operator=(const set &__x)
Set assignment operator.
set & operator=(initializer_list< value_type > __l)
Set list assignment operator.
_Alloc_traits::reference reference
Iterator-related typedefs.
bool operator>=(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string doesn't precede string.
_T2 second
first is a copy of the first object
std::pair< iterator, bool > emplace(_Args &&...__args)
Attempts to build and insert an element into the set.
void insert(initializer_list< value_type > __l)
Attempts to insert a list of elements into the set.
set(_InputIterator __first, _InputIterator __last, const _Compare &__comp, const allocator_type &__a=allocator_type())
Builds a set from a range.
allocator_type get_allocator() const noexcept
Returns the allocator object with which the set was constructed.
_Alloc allocator_type
Public typedefs.
set()
Default constructor creates no elements.
_T1 first
second_type is the second bound type
bool empty() const noexcept
Returns true if the set is empty.
reverse_iterator rbegin() const noexcept
std::pair< iterator, bool > insert(const value_type &__x)
Attempts to insert an element into the set.
_Rep_type::const_iterator const_iterator
Iterator-related typedefs.
_Key key_type
Public typedefs.
size_type count(const key_type &__x) const
Finds the number of elements.
set(set &&__x) noexcept(is_nothrow_copy_constructible< _Compare >::value)
Set move constructor
_Alloc_traits::pointer pointer
Iterator-related typedefs.
bool operator>(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string follows string.
_Rep_type::difference_type difference_type
Iterator-related typedefs.
_Alloc_traits::const_pointer const_pointer
Iterator-related typedefs.
iterator lower_bound(const key_type &__x)
Finds the beginning of a subsequence matching given key.
const_iterator upper_bound(const key_type &__x) const
Finds the end of a subsequence matching given key.
set(set &&__x, const allocator_type &__a) noexcept(is_nothrow_copy_constructible< _Compare >::value &&_Alloc_traits::_S_always_equal())
Allocator-extended move constructor.
const_iterator find(const key_type &__x) const
Tries to locate an element in a set.
key_compare key_comp() const
Returns the comparison object with which the set was constructed.
_Rep_type::const_reverse_iterator reverse_iterator
Iterator-related typedefs.
iterator begin() const noexcept
reverse_iterator crbegin() const noexcept
iterator cend() const noexcept
size_type erase(const key_type &__x)
Erases elements according to the provided key.
iterator end() const noexcept
iterator insert(const_iterator __position, const value_type &__x)
Attempts to insert an element into the set.
iterator emplace_hint(const_iterator __pos, _Args &&...__args)
Attempts to insert an element into the set.
set(const set &__x)
Set copy constructor.
value_compare value_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.
void swap(set &__x) noexcept(_Alloc_traits::_S_nothrow_swap())
Swaps data with another set.
_Compare value_compare
Public typedefs.
iterator find(const key_type &__x)
Tries to locate an element in a set.
_GLIBCXX_ABI_TAG_CXX11 iterator erase(const_iterator __first, const_iterator __last)
Erases a [__first,__last) range of elements from a set.
Struct holding two objects of arbitrary type.
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key.
A standard container made up of unique keys, which can be retrieved in logarithmic time...
set(const set &__x, const allocator_type &__a)
Allocator-extended copy constructor.
set(_InputIterator __first, _InputIterator __last, const allocator_type &__a)
Allocator-extended range constructor.
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.
reverse_iterator crend() const noexcept
set(initializer_list< value_type > __l, const _Compare &__comp=_Compare(), const allocator_type &__a=allocator_type())
Builds a set from an initializer_list.
_Rep_type::const_iterator iterator
Iterator-related typedefs.
void insert(_InputIterator __first, _InputIterator __last)
A template function that attempts to insert a range of elements.
ISO C++ entities toplevel namespace is std.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
set(const _Compare &__comp, const allocator_type &__a=allocator_type())
Creates a set with no elements.
_Compare key_compare
Public typedefs.
_Rep_type::const_reverse_iterator const_reverse_iterator
Iterator-related typedefs.