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
281 if (!_M_t._M_move_assign(__x._M_t))
286 insert(std::__make_move_if_noexcept_iterator(__x._M_t.begin()),
287 std::__make_move_if_noexcept_iterator(__x._M_t.end()));
308 this->
insert(__l.begin(), __l.end());
318 {
return _M_t.key_comp(); }
322 {
return _M_t.key_comp(); }
335 {
return _M_t.begin(); }
343 end() const _GLIBCXX_NOEXCEPT
344 {
return _M_t.end(); }
353 {
return _M_t.rbegin(); }
362 {
return _M_t.rend(); }
364 #if __cplusplus >= 201103L
372 {
return _M_t.begin(); }
381 {
return _M_t.end(); }
390 {
return _M_t.rbegin(); }
399 {
return _M_t.rend(); }
405 {
return _M_t.empty(); }
410 {
return _M_t.size(); }
415 {
return _M_t.max_size(); }
430 #if __cplusplus >= 201103L
431 noexcept(_Alloc_traits::_S_nothrow_swap())
433 { _M_t.swap(__x._M_t); }
436 #if __cplusplus >= 201103L
450 template<
typename... _Args>
453 {
return _M_t._M_emplace_unique(std::forward<_Args>(__args)...); }
476 template<
typename... _Args>
480 return _M_t._M_emplace_hint_unique(__pos,
481 std::forward<_Args>(__args)...);
502 _M_t._M_insert_unique(__x);
506 #if __cplusplus >= 201103L
536 insert(const_iterator __position,
const value_type& __x)
537 {
return _M_t._M_insert_unique_(__position, __x); }
539 #if __cplusplus >= 201103L
541 insert(const_iterator __position, value_type&& __x)
542 {
return _M_t._M_insert_unique_(__position,
std::move(__x)); }
554 template<
typename _InputIterator>
556 insert(_InputIterator __first, _InputIterator __last)
557 { _M_t._M_insert_unique(__first, __last); }
559 #if __cplusplus >= 201103L
569 { this->
insert(__l.begin(), __l.end()); }
572 #if __cplusplus >= 201103L
588 _GLIBCXX_ABI_TAG_CXX11
591 {
return _M_t.erase(__position); }
604 erase(iterator __position)
605 { _M_t.erase(__position); }
621 {
return _M_t.erase(__x); }
623 #if __cplusplus >= 201103L
640 _GLIBCXX_ABI_TAG_CXX11
642 erase(const_iterator __first, const_iterator __last)
643 {
return _M_t.erase(__first, __last); }
658 erase(iterator __first, iterator __last)
659 { _M_t.erase(__first, __last); }
684 {
return _M_t.find(__x) == _M_t.end() ? 0 : 1; }
702 {
return _M_t.find(__x); }
705 find(
const key_type& __x)
const
706 {
return _M_t.find(__x); }
723 {
return _M_t.lower_bound(__x); }
727 {
return _M_t.lower_bound(__x); }
739 {
return _M_t.upper_bound(__x); }
743 {
return _M_t.upper_bound(__x); }
764 {
return _M_t.equal_range(__x); }
768 {
return _M_t.equal_range(__x); }
771 template<
typename _K1,
typename _C1,
typename _A1>
775 template<
typename _K1,
typename _C1,
typename _A1>
791 template<
typename _Key,
typename _Compare,
typename _Alloc>
795 {
return __x._M_t == __y._M_t; }
808 template<
typename _Key,
typename _Compare,
typename _Alloc>
810 operator<(const set<_Key, _Compare, _Alloc>& __x,
812 {
return __x._M_t < __y._M_t; }
815 template<
typename _Key,
typename _Compare,
typename _Alloc>
819 {
return !(__x == __y); }
822 template<
typename _Key,
typename _Compare,
typename _Alloc>
826 {
return __y < __x; }
829 template<
typename _Key,
typename _Compare,
typename _Alloc>
831 operator<=(const set<_Key, _Compare, _Alloc>& __x,
833 {
return !(__y < __x); }
836 template<
typename _Key,
typename _Compare,
typename _Alloc>
840 {
return !(__x < __y); }
843 template<
typename _Key,
typename _Compare,
typename _Alloc>
848 _GLIBCXX_END_NAMESPACE_CONTAINER
size_type max_size() const noexcept
Returns the maximum size of 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.
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.
_Key value_type
Public typedefs.
set & operator=(const set &__x)
Set assignment operator.
_Compare key_compare
Public typedefs.
set & operator=(set &&__x) noexcept(_Alloc_traits::_S_nothrow_move())
Set move assignment operator.
Uniform interface to C++98 and C++0x allocators.
set(_InputIterator __first, _InputIterator __last, const _Compare &__comp, const allocator_type &__a=allocator_type())
Builds a set from a range.
set(_InputIterator __first, _InputIterator __last)
Builds a set from a range.
set(const allocator_type &__a)
Allocator-extended default constructor.
reverse_iterator rend() const noexcept
_Alloc allocator_type
Public typedefs.
set(initializer_list< value_type > __l, const allocator_type &__a)
Allocator-extended initialier-list constructor.
set()
Default constructor creates no elements.
bool empty() const noexcept
Returns true if the set is empty.
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.
set & operator=(initializer_list< value_type > __l)
Set list assignment operator.
_Alloc_traits::reference reference
Iterator-related typedefs.
size_type count(const key_type &__x) const
Finds the number of elements.
std::pair< iterator, bool > emplace(_Args &&...__args)
Attempts to build and insert an element into the set.
_Alloc_traits::pointer pointer
Iterator-related typedefs.
void insert(initializer_list< value_type > __l)
Attempts to insert a list of elements into the set.
iterator lower_bound(const key_type &__x)
Finds the beginning of a subsequence matching given key.
allocator_type get_allocator() const noexcept
Returns the allocator object with which the set was constructed.
const_iterator upper_bound(const key_type &__x) const
Finds the end of a subsequence matching given key.
const_iterator find(const key_type &__x) const
Tries to locate an element in a set.
_Rep_type::const_reverse_iterator reverse_iterator
Iterator-related typedefs.
reverse_iterator rbegin() const noexcept
_T1 first
second_type is the second bound type
_Key key_type
Public typedefs.
ISO C++ entities toplevel namespace is std.
set(set &&__x) noexcept(is_nothrow_copy_constructible< _Compare >::value)
Set move constructor
iterator cend() const noexcept
size_type erase(const key_type &__x)
Erases elements according to the provided key.
_Rep_type::difference_type difference_type
Iterator-related typedefs.
iterator end() const noexcept
_Alloc_traits::const_pointer const_pointer
Iterator-related typedefs.
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(set &&__x, const allocator_type &__a) noexcept(is_nothrow_copy_constructible< _Compare >::value &&_Alloc_traits::_S_always_equal())
Allocator-extended move constructor.
set(const set &__x)
Set copy 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.
iterator begin() const noexcept
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key.
bool operator>=(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string doesn't precede string.
reverse_iterator crbegin() const noexcept
set(const set &__x, const allocator_type &__a)
Allocator-extended copy constructor.
A standard container made up of unique keys, which can be retrieved in logarithmic time...
set(_InputIterator __first, _InputIterator __last, const allocator_type &__a)
Allocator-extended range constructor.
bool operator>(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string follows string.
value_compare value_comp() const
Returns the comparison object with which the set was constructed.
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.
_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.
_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.
void swap(_Tp &, _Tp &) noexcept(__and_< is_nothrow_move_constructible< _Tp >, is_nothrow_move_assignable< _Tp >>::value)
Swaps two values.
_Rep_type::const_reverse_iterator const_reverse_iterator
Iterator-related typedefs.
iterator cbegin() const noexcept
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
_T2 second
first is a copy of the first object
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.
size_type size() const noexcept
Returns the size of the set.
_Alloc_traits::const_reference const_reference
Iterator-related typedefs.