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)
111 typedef typename _Alloc::template rebind<_Key>::other _Key_alloc_type;
113 typedef _Rb_tree<key_type, value_type, _Identity<value_type>,
120 typedef typename _Key_alloc_type::pointer
pointer;
127 typedef typename _Rep_type::const_iterator
iterator;
148 set(
const _Compare& __comp,
150 : _M_t(__comp, _Key_alloc_type(__a)) { }
162 template<
typename _InputIterator>
163 set(_InputIterator __first, _InputIterator __last)
165 { _M_t._M_insert_unique(__first, __last); }
179 template<
typename _InputIterator>
180 set(_InputIterator __first, _InputIterator __last,
181 const _Compare& __comp,
183 : _M_t(__comp, _Key_alloc_type(__a))
184 { _M_t._M_insert_unique(__first, __last); }
196 #if __cplusplus >= 201103L
205 noexcept(is_nothrow_copy_constructible<_Compare>::value)
206 : _M_t(
std::
move(__x._M_t)) { }
218 set(initializer_list<value_type> __l,
219 const _Compare& __comp = _Compare(),
221 : _M_t(__comp, _Key_alloc_type(__a))
222 { _M_t._M_insert_unique(__l.begin(), __l.end()); }
239 #if __cplusplus >= 201103L
272 this->
insert(__l.begin(), __l.end());
282 {
return _M_t.key_comp(); }
286 {
return _M_t.key_comp(); }
299 {
return _M_t.begin(); }
307 end() const _GLIBCXX_NOEXCEPT
308 {
return _M_t.end(); }
317 {
return _M_t.rbegin(); }
326 {
return _M_t.rend(); }
328 #if __cplusplus >= 201103L
336 {
return _M_t.begin(); }
345 {
return _M_t.end(); }
354 {
return _M_t.rbegin(); }
363 {
return _M_t.rend(); }
369 {
return _M_t.empty(); }
374 {
return _M_t.size(); }
379 {
return _M_t.max_size(); }
394 { _M_t.swap(__x._M_t); }
397 #if __cplusplus >= 201103L
411 template<
typename... _Args>
414 {
return _M_t._M_emplace_unique(std::forward<_Args>(__args)...); }
437 template<
typename... _Args>
441 return _M_t._M_emplace_hint_unique(__pos,
442 std::forward<_Args>(__args)...);
463 _M_t._M_insert_unique(__x);
467 #if __cplusplus >= 201103L
497 insert(const_iterator __position,
const value_type& __x)
498 {
return _M_t._M_insert_unique_(__position, __x); }
500 #if __cplusplus >= 201103L
502 insert(const_iterator __position, value_type&& __x)
503 {
return _M_t._M_insert_unique_(__position,
std::move(__x)); }
515 template<
typename _InputIterator>
517 insert(_InputIterator __first, _InputIterator __last)
518 { _M_t._M_insert_unique(__first, __last); }
520 #if __cplusplus >= 201103L
530 { this->
insert(__l.begin(), __l.end()); }
533 #if __cplusplus >= 201103L
549 _GLIBCXX_ABI_TAG_CXX11
552 {
return _M_t.erase(__position); }
565 erase(iterator __position)
566 { _M_t.erase(__position); }
582 {
return _M_t.erase(__x); }
584 #if __cplusplus >= 201103L
601 _GLIBCXX_ABI_TAG_CXX11
603 erase(const_iterator __first, const_iterator __last)
604 {
return _M_t.erase(__first, __last); }
619 erase(iterator __first, iterator __last)
620 { _M_t.erase(__first, __last); }
645 {
return _M_t.find(__x) == _M_t.end() ? 0 : 1; }
663 {
return _M_t.find(__x); }
666 find(
const key_type& __x)
const
667 {
return _M_t.find(__x); }
684 {
return _M_t.lower_bound(__x); }
688 {
return _M_t.lower_bound(__x); }
700 {
return _M_t.upper_bound(__x); }
704 {
return _M_t.upper_bound(__x); }
725 {
return _M_t.equal_range(__x); }
729 {
return _M_t.equal_range(__x); }
732 template<
typename _K1,
typename _C1,
typename _A1>
736 template<
typename _K1,
typename _C1,
typename _A1>
752 template<
typename _Key,
typename _Compare,
typename _Alloc>
756 {
return __x._M_t == __y._M_t; }
769 template<
typename _Key,
typename _Compare,
typename _Alloc>
771 operator<(const set<_Key, _Compare, _Alloc>& __x,
773 {
return __x._M_t < __y._M_t; }
776 template<
typename _Key,
typename _Compare,
typename _Alloc>
780 {
return !(__x == __y); }
783 template<
typename _Key,
typename _Compare,
typename _Alloc>
787 {
return __y < __x; }
790 template<
typename _Key,
typename _Compare,
typename _Alloc>
792 operator<=(const set<_Key, _Compare, _Alloc>& __x,
794 {
return !(__y < __x); }
797 template<
typename _Key,
typename _Compare,
typename _Alloc>
801 {
return !(__x < __y); }
804 template<
typename _Key,
typename _Compare,
typename _Alloc>
809 _GLIBCXX_END_NAMESPACE_CONTAINER
_Rep_type::const_iterator iterator
Iterator-related typedefs.
_Compare value_compare
Public typedefs.
value_compare value_comp() const
Returns the comparison object with which the set was constructed.
_Alloc allocator_type
Public typedefs.
_Rep_type::const_iterator const_iterator
Iterator-related typedefs.
_Key_alloc_type::const_pointer const_pointer
Iterator-related typedefs.
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.
void insert(initializer_list< value_type > __l)
Attempts to insert a list of elements into the set.
std::pair< iterator, bool > emplace(_Args &&...__args)
Attempts to build and insert an element into the set.
iterator insert(const_iterator __position, const value_type &__x)
Attempts to insert an element into the set.
bool empty() const noexcept
Returns true if the set is empty.
size_type count(const key_type &__x) const
Finds the number of elements.
reverse_iterator rend() const noexcept
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
set()
Default constructor creates no elements.
bool operator>=(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string doesn't precede string.
key_compare key_comp() const
Returns the comparison object with which the set was constructed.
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.
ISO C++ entities toplevel namespace is std.
_Key_alloc_type::pointer pointer
Iterator-related typedefs.
size_type max_size() const noexcept
Returns the maximum size of the set.
_T1 first
second_type is the second bound type
_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.
_Compare key_compare
Public typedefs.
set(set &&__x) noexcept(is_nothrow_copy_constructible< _Compare >::value)
Set move constructor
const_iterator upper_bound(const key_type &__x) const
Finds the end of a subsequence matching given key.
_Key value_type
Public typedefs.
iterator find(const key_type &__x)
Tries to locate an element in a set.
iterator lower_bound(const key_type &__x)
Finds the beginning of a subsequence matching given key.
iterator end() 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.
set & operator=(set &&__x)
Set move assignment operator.
iterator cend() const noexcept
iterator emplace_hint(const_iterator __pos, _Args &&...__args)
Attempts to insert an element into the set.
size_type erase(const key_type &__x)
Erases elements according to the provided key.
const_iterator lower_bound(const key_type &__x) const
Finds the beginning of a subsequence matching given key.
size_type size() const noexcept
Returns the size of the set.
_GLIBCXX_ABI_TAG_CXX11 iterator erase(const_iterator __first, const_iterator __last)
Erases a [__first,__last) range of elements from a set.
iterator upper_bound(const key_type &__x)
Finds the end of a subsequence matching given key.
void swap(_Tp &, _Tp &) noexcept(__and_< is_nothrow_move_constructible< _Tp >, is_nothrow_move_assignable< _Tp >>::value)
Swaps two values.
A standard container made up of unique keys, which can be retrieved in logarithmic time...
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key.
iterator cbegin() const noexcept
allocator_type get_allocator() const noexcept
Returns the allocator object with which the set was constructed.
_Key_alloc_type::const_reference const_reference
Iterator-related typedefs.
const_iterator find(const key_type &__x) const
Tries to locate an element in a set.
_Rep_type::difference_type difference_type
Iterator-related typedefs.
_GLIBCXX_ABI_TAG_CXX11 iterator erase(const_iterator __position)
Erases an element from a set.
_Key key_type
Public typedefs.
void swap(set &__x)
Swaps data with another set.
iterator begin() const noexcept
Struct holding two objects of arbitrary type.
set(const set &__x)
Set copy constructor.
_Rep_type::const_reverse_iterator reverse_iterator
Iterator-related typedefs.
_Key_alloc_type::reference reference
Iterator-related typedefs.
_T2 second
first is a copy of the first object
set(const _Compare &__comp, const allocator_type &__a=allocator_type())
Creates a set with no elements.
reverse_iterator crbegin() const noexcept
set & operator=(const set &__x)
Set assignment operator.
reverse_iterator crend() const noexcept
reverse_iterator rbegin() const noexcept
bool operator>(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string follows string.
set & operator=(initializer_list< value_type > __l)
Set list assignment operator.