61 #ifdef __GXX_EXPERIMENTAL_CXX0X__
65 namespace std _GLIBCXX_VISIBILITY(default)
67 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
89 template<
typename _Key,
typename _Compare = std::less<_Key>,
90 typename _Alloc = std::allocator<_Key> >
94 typedef typename _Alloc::value_type _Alloc_value_type;
95 __glibcxx_class_requires(_Key, _SGIAssignableConcept)
96 __glibcxx_class_requires4(_Compare,
bool, _Key, _Key,
97 _BinaryFunctionConcept)
98 __glibcxx_class_requires2(_Key, _Alloc_value_type, _SameTypeConcept)
112 typedef typename _Alloc::template rebind<_Key>::other _Key_alloc_type;
114 typedef _Rb_tree<key_type, value_type, _Identity<value_type>,
121 typedef typename _Key_alloc_type::pointer
pointer;
128 typedef typename _Rep_type::const_iterator
iterator;
149 set(
const _Compare& __comp,
151 : _M_t(__comp, _Key_alloc_type(__a)) { }
163 template<
typename _InputIterator>
164 set(_InputIterator __first, _InputIterator __last)
166 { _M_t._M_insert_unique(__first, __last); }
180 template<
typename _InputIterator>
181 set(_InputIterator __first, _InputIterator __last,
182 const _Compare& __comp,
184 : _M_t(__comp, _Key_alloc_type(__a))
185 { _M_t._M_insert_unique(__first, __last); }
197 #ifdef __GXX_EXPERIMENTAL_CXX0X__
207 : _M_t(std::move(__x._M_t)) { }
220 const _Compare& __comp = _Compare(),
222 : _M_t(__comp, _Key_alloc_type(__a))
223 { _M_t._M_insert_unique(__l.begin(), __l.end()); }
240 #ifdef __GXX_EXPERIMENTAL_CXX0X__
273 this->
insert(__l.begin(), __l.end());
283 {
return _M_t.key_comp(); }
287 {
return _M_t.key_comp(); }
300 {
return _M_t.begin(); }
308 end() const _GLIBCXX_NOEXCEPT
309 {
return _M_t.end(); }
318 {
return _M_t.rbegin(); }
327 {
return _M_t.rend(); }
329 #ifdef __GXX_EXPERIMENTAL_CXX0X__
337 {
return _M_t.begin(); }
346 {
return _M_t.end(); }
355 {
return _M_t.rbegin(); }
364 {
return _M_t.rend(); }
370 {
return _M_t.empty(); }
375 {
return _M_t.size(); }
380 {
return _M_t.max_size(); }
395 { _M_t.swap(__x._M_t); }
415 _M_t._M_insert_unique(__x);
419 #ifdef __GXX_EXPERIMENTAL_CXX0X__
424 _M_t._M_insert_unique(std::move(__x));
450 {
return _M_t._M_insert_unique_(__position, __x); }
452 #ifdef __GXX_EXPERIMENTAL_CXX0X__
455 {
return _M_t._M_insert_unique_(__position, std::move(__x)); }
467 template<
typename _InputIterator>
469 insert(_InputIterator __first, _InputIterator __last)
470 { _M_t._M_insert_unique(__first, __last); }
472 #ifdef __GXX_EXPERIMENTAL_CXX0X__
482 { this->
insert(__l.begin(), __l.end()); }
485 #ifdef __GXX_EXPERIMENTAL_CXX0X__
503 {
return _M_t.erase(__position); }
517 { _M_t.erase(__position); }
533 {
return _M_t.erase(__x); }
535 #ifdef __GXX_EXPERIMENTAL_CXX0X__
554 {
return _M_t.erase(__first, __last); }
570 { _M_t.erase(__first, __last); }
595 {
return _M_t.find(__x) == _M_t.end() ? 0 : 1; }
613 {
return _M_t.find(__x); }
617 {
return _M_t.find(__x); }
634 {
return _M_t.lower_bound(__x); }
638 {
return _M_t.lower_bound(__x); }
650 {
return _M_t.upper_bound(__x); }
654 {
return _M_t.upper_bound(__x); }
675 {
return _M_t.equal_range(__x); }
679 {
return _M_t.equal_range(__x); }
682 template<
typename _K1,
typename _C1,
typename _A1>
686 template<
typename _K1,
typename _C1,
typename _A1>
702 template<
typename _Key,
typename _Compare,
typename _Alloc>
706 {
return __x._M_t == __y._M_t; }
719 template<
typename _Key,
typename _Compare,
typename _Alloc>
721 operator<(const set<_Key, _Compare, _Alloc>& __x,
723 {
return __x._M_t < __y._M_t; }
726 template<
typename _Key,
typename _Compare,
typename _Alloc>
730 {
return !(__x == __y); }
733 template<
typename _Key,
typename _Compare,
typename _Alloc>
737 {
return __y < __x; }
740 template<
typename _Key,
typename _Compare,
typename _Alloc>
742 operator<=(const set<_Key, _Compare, _Alloc>& __x,
744 {
return !(__y < __x); }
747 template<
typename _Key,
typename _Compare,
typename _Alloc>
751 {
return !(__x < __y); }
754 template<
typename _Key,
typename _Compare,
typename _Alloc>
759 _GLIBCXX_END_NAMESPACE_CONTAINER
set(initializer_list< value_type > __l, const _Compare &__comp=_Compare(), const allocator_type &__a=allocator_type())
Builds a set from an initializer_list.
_T1 first
second_type is the second bound type
size_type count(const key_type &__x) const
Finds the number of elements.
_T2 second
first is a copy of the first object
std::pair< iterator, bool > insert(const value_type &__x)
Attempts to insert an element into the set.
reverse_iterator crbegin() const noexcept
The standard allocator, as per [20.4].
iterator cend() const noexcept
allocator_type get_allocator() const _GLIBCXX_NOEXCEPT
Returns the allocator object with which the set was constructed.
_Rep_type::difference_type difference_type
Iterator-related typedefs.
_Key key_type
Public typedefs.
key_compare key_comp() const
Returns the comparison object with which the set was constructed.
_Compare key_compare
Public typedefs.
set(const set &__x)
Set copy constructor.
set & operator=(set &&__x)
Set move assignment operator.
bool empty() const _GLIBCXX_NOEXCEPT
Returns true if the set is empty.
_Compare value_compare
Public typedefs.
iterator cbegin() const noexcept
set()
Default constructor creates no elements.
_Rep_type::const_reverse_iterator const_reverse_iterator
Iterator-related typedefs.
_Rep_type::const_reverse_iterator reverse_iterator
Iterator-related typedefs.
std::pair< const_iterator, const_iterator > equal_range(const key_type &__x) const
Finds a subsequence matching given key.
reverse_iterator crend() const noexcept
_Alloc allocator_type
Public typedefs.
_Key_alloc_type::pointer pointer
Iterator-related typedefs.
_Key_alloc_type::reference reference
Iterator-related typedefs.
set(_InputIterator __first, _InputIterator __last, const _Compare &__comp, const allocator_type &__a=allocator_type())
Builds a set from a range.
reverse_iterator rend() const _GLIBCXX_NOEXCEPT
iterator lower_bound(const key_type &__x)
Finds the beginning of a subsequence matching given key.
set & operator=(const set &__x)
Set assignment operator.
_Rep_type::const_iterator const_iterator
Iterator-related typedefs.
set(const _Compare &__comp, const allocator_type &__a=allocator_type())
Creates a set with no elements.
iterator erase(const_iterator __first, const_iterator __last)
Erases a [__first,__last) range of elements from a set.
iterator erase(const_iterator __position)
Erases an element from a set.
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.
_Key_alloc_type::const_reference const_reference
Iterator-related typedefs.
_Key_alloc_type::const_pointer const_pointer
Iterator-related typedefs.
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key.
size_type max_size() const _GLIBCXX_NOEXCEPT
Returns the maximum size of the set.
set(_InputIterator __first, _InputIterator __last)
Builds a set from a range.
set(set &&__x) noexcept(is_nothrow_copy_constructible< _Compare >::value)
Set move constructor
set & operator=(initializer_list< value_type > __l)
Set list assignment operator.
size_type size() const _GLIBCXX_NOEXCEPT
Returns the size of the set.
const_iterator lower_bound(const key_type &__x) const
Finds the beginning of a subsequence matching given key.
Struct holding two objects of arbitrary type.
A standard container made up of unique keys, which can be retrieved in logarithmic time...
iterator begin() const _GLIBCXX_NOEXCEPT
_Rep_type::size_type size_type
Iterator-related typedefs.
void clear() _GLIBCXX_NOEXCEPT
iterator find(const key_type &__x)
Tries to locate an element in a set.
_Key value_type
Public typedefs.
void swap(set &__x)
Swaps data with another set.
void insert(_InputIterator __first, _InputIterator __last)
A template function that attempts to insert a range of elements.
_Rep_type::const_iterator iterator
Iterator-related typedefs.
is_nothrow_copy_constructible
iterator end() const _GLIBCXX_NOEXCEPT
reverse_iterator rbegin() const _GLIBCXX_NOEXCEPT
void insert(initializer_list< value_type > __l)
Attempts to insert a list of elements into the set.
size_type erase(const key_type &__x)
Erases elements according to the provided key.
iterator insert(const_iterator __position, const value_type &__x)
Attempts to insert an element into the set.
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.