29 #ifndef _GLIBCXX_DEBUG_SET_H
30 #define _GLIBCXX_DEBUG_SET_H 1
36 namespace std _GLIBCXX_VISIBILITY(default)
41 template<
typename _Key,
typename _Compare = std::less<_Key>,
42 typename _Allocator = std::allocator<_Key> >
47 typedef _GLIBCXX_STD_C::set<_Key, _Compare, _Allocator>
_Base;
54 typedef _Key key_type;
55 typedef _Key value_type;
56 typedef _Compare key_compare;
57 typedef _Compare value_compare;
58 typedef _Allocator allocator_type;
59 typedef typename _Base::reference reference;
60 typedef typename _Base::const_reference const_reference;
67 typedef typename _Base::size_type size_type;
68 typedef typename _Base::difference_type difference_type;
69 typedef typename _Base::pointer pointer;
70 typedef typename _Base::const_pointer const_pointer;
75 explicit set(
const _Compare& __comp = _Compare(),
76 const _Allocator& __a = _Allocator())
77 :
_Base(__comp, __a) { }
79 template<
typename _InputIterator>
80 set(_InputIterator __first, _InputIterator __last,
81 const _Compare& __comp = _Compare(),
82 const _Allocator& __a = _Allocator())
94 #if __cplusplus >= 201103L
96 noexcept(is_nothrow_copy_constructible<_Compare>::value)
97 :
_Base(std::move(__x))
101 const _Compare& __comp = _Compare(),
102 const allocator_type& __a = allocator_type())
103 :
_Base(__l, __comp, __a) { }
106 ~
set() _GLIBCXX_NOEXCEPT { }
109 operator=(
const set& __x)
111 *
static_cast<_Base*
>(
this) = __x;
112 this->_M_invalidate_all();
116 #if __cplusplus >= 201103L
122 __glibcxx_check_self_move_assign(__x);
137 using _Base::get_allocator;
141 begin() _GLIBCXX_NOEXCEPT
142 {
return iterator(_Base::begin(),
this); }
145 begin()
const _GLIBCXX_NOEXCEPT
149 end() _GLIBCXX_NOEXCEPT
150 {
return iterator(_Base::end(),
this); }
153 end()
const _GLIBCXX_NOEXCEPT
157 rbegin() _GLIBCXX_NOEXCEPT
161 rbegin()
const _GLIBCXX_NOEXCEPT
165 rend() _GLIBCXX_NOEXCEPT
169 rend()
const _GLIBCXX_NOEXCEPT
172 #if __cplusplus >= 201103L
174 cbegin()
const noexcept
178 cend()
const noexcept
182 crbegin()
const noexcept
186 crend()
const noexcept
193 using _Base::max_size;
196 #if __cplusplus >= 201103L
197 template<
typename... _Args>
199 emplace(_Args&&... __args)
201 auto __res = _Base::emplace(std::forward<_Args>(__args)...);
206 template<
typename... _Args>
212 std::forward<_Args>(__args)...),
218 insert(
const value_type& __x)
225 #if __cplusplus >= 201103L
227 insert(value_type&& __x)
230 = _Base::insert(std::move(__x));
240 return iterator(_Base::insert(__position.
base(), __x),
this);
243 #if __cplusplus >= 201103L
248 return iterator(_Base::insert(__position.
base(), std::move(__x)),
253 template <
typename _InputIterator>
255 insert(_InputIterator __first, _InputIterator __last)
257 __glibcxx_check_valid_range(__first, __last);
262 #if __cplusplus >= 201103L
265 { _Base::insert(__l); }
268 #if __cplusplus >= 201103L
282 _Base::erase(__position.
base());
287 erase(
const key_type& __x)
290 if (__victim == _Base::end())
295 _Base::erase(__victim);
300 #if __cplusplus >= 201103L
308 __victim != __last.
base(); ++__victim)
310 _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
311 _M_message(__gnu_debug::__msg_valid_range)
312 ._M_iterator(__first,
"first")
313 ._M_iterator(__last,
"last"));
326 __victim != __last.
base(); ++__victim)
328 _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
329 _M_message(__gnu_debug::__msg_valid_range)
330 ._M_iterator(__first,
"first")
331 ._M_iterator(__last,
"last"));
334 _Base::erase(__first.
base(), __last.
base());
346 clear() _GLIBCXX_NOEXCEPT
348 this->_M_invalidate_all();
353 using _Base::key_comp;
354 using _Base::value_comp;
358 find(
const key_type& __x)
359 {
return iterator(_Base::find(__x),
this); }
364 find(
const key_type& __x)
const
370 lower_bound(
const key_type& __x)
371 {
return iterator(_Base::lower_bound(__x),
this); }
376 lower_bound(
const key_type& __x)
const
380 upper_bound(
const key_type& __x)
381 {
return iterator(_Base::upper_bound(__x),
this); }
386 upper_bound(
const key_type& __x)
const
390 equal_range(
const key_type& __x)
393 _Base::equal_range(__x);
401 equal_range(
const key_type& __x)
const
404 _Base::equal_range(__x);
410 _M_base() _GLIBCXX_NOEXCEPT {
return *
this; }
413 _M_base()
const _GLIBCXX_NOEXCEPT {
return *
this; }
424 template<
typename _Key,
typename _Compare,
typename _Allocator>
428 {
return __lhs._M_base() == __rhs._M_base(); }
430 template<
typename _Key,
typename _Compare,
typename _Allocator>
434 {
return __lhs._M_base() != __rhs._M_base(); }
436 template<
typename _Key,
typename _Compare,
typename _Allocator>
438 operator<(const set<_Key, _Compare, _Allocator>& __lhs,
439 const set<_Key, _Compare, _Allocator>& __rhs)
440 {
return __lhs._M_base() < __rhs._M_base(); }
442 template<
typename _Key,
typename _Compare,
typename _Allocator>
444 operator<=(const set<_Key, _Compare, _Allocator>& __lhs,
445 const set<_Key, _Compare, _Allocator>& __rhs)
446 {
return __lhs._M_base() <= __rhs._M_base(); }
448 template<
typename _Key,
typename _Compare,
typename _Allocator>
450 operator>=(
const set<_Key, _Compare, _Allocator>& __lhs,
451 const set<_Key, _Compare, _Allocator>& __rhs)
452 {
return __lhs._M_base() >= __rhs._M_base(); }
454 template<
typename _Key,
typename _Compare,
typename _Allocator>
456 operator>(
const set<_Key, _Compare, _Allocator>& __lhs,
457 const set<_Key, _Compare, _Allocator>& __rhs)
458 {
return __lhs._M_base() > __rhs._M_base(); }
460 template<
typename _Key,
typename _Compare,
typename _Allocator>
462 swap(set<_Key, _Compare, _Allocator>& __x,
463 set<_Key, _Compare, _Allocator>& __y)
464 {
return __x.swap(__y); }
void _M_swap(_Safe_sequence_base &__x)
_T2 second
first is a copy of the first object
void _M_invalidate_if(_Predicate __pred)
#define __glibcxx_check_insert(_Position)
constexpr pair< typename __decay_and_strip< _T1 >::__type, typename __decay_and_strip< _T2 >::__type > make_pair(_T1 &&__x, _T2 &&__y)
A convenience wrapper for creating a pair from two objects.
_T1 first
second_type is the second bound type
constexpr size_t size() const noexcept
Returns the total number of bits.
Struct holding two objects of arbitrary type.
Class std::set with safety/checking/debug instrumentation.
size_t count() const noexcept
Returns the number of bits which are set.
_Iterator base() const noexcept
Return the underlying iterator.
bitset< _Nb > & set() noexcept
Sets every bit to true.
#define __glibcxx_check_erase(_Position)
void swap(function< _Res(_Args...)> &__x, function< _Res(_Args...)> &__y)
Swap the targets of two polymorphic function object wrappers.
Base class for constructing a safe sequence type that tracks iterators that reference it...
_Siter_base< _Iterator >::iterator_type __base(_Iterator __it)
#define __glibcxx_check_erase_range(_First, _Last)
A standard container made up of unique keys, which can be retrieved in logarithmic time...