30 #ifndef _GLIBCXX_DEBUG_SET_H
31 #define _GLIBCXX_DEBUG_SET_H 1
37 namespace std _GLIBCXX_VISIBILITY(default)
42 template<
typename _Key,
typename _Compare = std::less<_Key>,
43 typename _Allocator = std::allocator<_Key> >
48 typedef _GLIBCXX_STD_C::set<_Key, _Compare, _Allocator>
_Base;
55 typedef _Key key_type;
56 typedef _Key value_type;
57 typedef _Compare key_compare;
58 typedef _Compare value_compare;
59 typedef _Allocator allocator_type;
60 typedef typename _Base::reference reference;
61 typedef typename _Base::const_reference const_reference;
68 typedef typename _Base::size_type size_type;
69 typedef typename _Base::difference_type difference_type;
70 typedef typename _Base::pointer pointer;
71 typedef typename _Base::const_pointer const_pointer;
76 explicit set(
const _Compare& __comp = _Compare(),
77 const _Allocator& __a = _Allocator())
78 :
_Base(__comp, __a) { }
80 template<
typename _InputIterator>
81 set(_InputIterator __first, _InputIterator __last,
82 const _Compare& __comp = _Compare(),
83 const _Allocator& __a = _Allocator())
95 #ifdef __GXX_EXPERIMENTAL_CXX0X__
98 :
_Base(std::move(__x))
102 const _Compare& __comp = _Compare(),
103 const allocator_type& __a = allocator_type())
104 :
_Base(__l, __comp, __a) { }
107 ~
set() _GLIBCXX_NOEXCEPT { }
110 operator=(
const set& __x)
112 *
static_cast<_Base*
>(
this) = __x;
113 this->_M_invalidate_all();
117 #ifdef __GXX_EXPERIMENTAL_CXX0X__
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 #ifdef __GXX_EXPERIMENTAL_CXX0X__
174 cbegin()
const noexcept
178 cend()
const noexcept
182 crbegin()
const noexcept
186 crend()
const noexcept
193 using _Base::max_size;
197 insert(
const value_type& __x)
204 #ifdef __GXX_EXPERIMENTAL_CXX0X__
206 insert(value_type&& __x)
209 = _Base::insert(std::move(__x));
219 return iterator(_Base::insert(__position.
base(), __x),
this);
222 #ifdef __GXX_EXPERIMENTAL_CXX0X__
227 return iterator(_Base::insert(__position.
base(), std::move(__x)),
232 template <
typename _InputIterator>
234 insert(_InputIterator __first, _InputIterator __last)
236 __glibcxx_check_valid_range(__first, __last);
241 #ifdef __GXX_EXPERIMENTAL_CXX0X__
244 { _Base::insert(__l); }
247 #ifdef __GXX_EXPERIMENTAL_CXX0X__
261 _Base::erase(__position.
base());
266 erase(
const key_type& __x)
269 if (__victim == _Base::end())
274 _Base::erase(__victim);
279 #ifdef __GXX_EXPERIMENTAL_CXX0X__
287 __victim != __last.
base(); ++__victim)
289 _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
290 _M_message(__gnu_debug::__msg_valid_range)
291 ._M_iterator(__first,
"first")
292 ._M_iterator(__last,
"last"));
305 __victim != __last.
base(); ++__victim)
307 _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
308 _M_message(__gnu_debug::__msg_valid_range)
309 ._M_iterator(__first,
"first")
310 ._M_iterator(__last,
"last"));
313 _Base::erase(__first.
base(), __last.
base());
325 clear() _GLIBCXX_NOEXCEPT
327 this->_M_invalidate_all();
332 using _Base::key_comp;
333 using _Base::value_comp;
337 find(
const key_type& __x)
338 {
return iterator(_Base::find(__x),
this); }
343 find(
const key_type& __x)
const
349 lower_bound(
const key_type& __x)
350 {
return iterator(_Base::lower_bound(__x),
this); }
355 lower_bound(
const key_type& __x)
const
359 upper_bound(
const key_type& __x)
360 {
return iterator(_Base::upper_bound(__x),
this); }
365 upper_bound(
const key_type& __x)
const
369 equal_range(
const key_type& __x)
372 _Base::equal_range(__x);
380 equal_range(
const key_type& __x)
const
383 _Base::equal_range(__x);
389 _M_base() _GLIBCXX_NOEXCEPT {
return *
this; }
392 _M_base()
const _GLIBCXX_NOEXCEPT {
return *
this; }
403 template<
typename _Key,
typename _Compare,
typename _Allocator>
407 {
return __lhs._M_base() == __rhs._M_base(); }
409 template<
typename _Key,
typename _Compare,
typename _Allocator>
413 {
return __lhs._M_base() != __rhs._M_base(); }
415 template<
typename _Key,
typename _Compare,
typename _Allocator>
417 operator<(const set<_Key, _Compare, _Allocator>& __lhs,
418 const set<_Key, _Compare, _Allocator>& __rhs)
419 {
return __lhs._M_base() < __rhs._M_base(); }
421 template<
typename _Key,
typename _Compare,
typename _Allocator>
423 operator<=(const set<_Key, _Compare, _Allocator>& __lhs,
424 const set<_Key, _Compare, _Allocator>& __rhs)
425 {
return __lhs._M_base() <= __rhs._M_base(); }
427 template<
typename _Key,
typename _Compare,
typename _Allocator>
429 operator>=(
const set<_Key, _Compare, _Allocator>& __lhs,
430 const set<_Key, _Compare, _Allocator>& __rhs)
431 {
return __lhs._M_base() >= __rhs._M_base(); }
433 template<
typename _Key,
typename _Compare,
typename _Allocator>
435 operator>(
const set<_Key, _Compare, _Allocator>& __lhs,
436 const set<_Key, _Compare, _Allocator>& __rhs)
437 {
return __lhs._M_base() > __rhs._M_base(); }
439 template<
typename _Key,
typename _Compare,
typename _Allocator>
441 swap(set<_Key, _Compare, _Allocator>& __x,
442 set<_Key, _Compare, _Allocator>& __y)
443 {
return __x.swap(__y); }
_Siter_base< _Iterator >::iterator_type __base(_Iterator __it)
_T1 first
second_type is the second bound type
_T2 second
first is a copy of the first object
#define __glibcxx_check_erase_range(_First, _Last)
void _M_swap(_Safe_sequence_base &__x)
void _M_invalidate_if(_Predicate __pred)
_Iterator base() const
Return the underlying iterator.
#define __glibcxx_check_erase(_Position)
size_t count() const _GLIBCXX_NOEXCEPT
Returns the number of bits which are set.
#define __glibcxx_check_insert(_Position)
Struct holding two objects of arbitrary type.
Class std::set with safety/checking/debug instrumentation.
A standard container made up of unique keys, which can be retrieved in logarithmic time...
Base class for constructing a safe sequence type that tracks iterators that reference it...
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.
bitset< _Nb > & set() _GLIBCXX_NOEXCEPT
Sets every bit to true.
is_nothrow_copy_constructible
constexpr size_t size() const _GLIBCXX_NOEXCEPT
Returns the total number of bits.