29 #ifndef _GLIBCXX_PROFILE_SET_H
30 #define _GLIBCXX_PROFILE_SET_H 1
34 namespace std _GLIBCXX_VISIBILITY(default)
39 template<
typename _Key,
typename _Compare = std::less<_Key>,
40 typename _Allocator = std::allocator<_Key> >
42 :
public _GLIBCXX_STD_C::set<_Key,_Compare,_Allocator>
44 typedef _GLIBCXX_STD_C::set<_Key, _Compare, _Allocator>
_Base;
48 typedef _Key key_type;
49 typedef _Key value_type;
50 typedef _Compare key_compare;
51 typedef _Compare value_compare;
52 typedef _Allocator allocator_type;
53 typedef typename _Base::reference reference;
54 typedef typename _Base::const_reference const_reference;
56 typedef typename _Base::iterator iterator;
57 typedef typename _Base::const_iterator const_iterator;
58 typedef typename _Base::reverse_iterator reverse_iterator;
59 typedef typename _Base::const_reverse_iterator const_reverse_iterator;
61 typedef typename _Base::size_type size_type;
62 typedef typename _Base::difference_type difference_type;
63 typedef typename _Base::pointer pointer;
64 typedef typename _Base::const_pointer const_pointer;
67 explicit set(
const _Compare& __comp = _Compare(),
68 const _Allocator& __a = _Allocator())
69 : _Base(__comp, __a) { }
71 #if __cplusplus >= 201103L
72 template<
typename _InputIterator,
73 typename = std::_RequireInputIter<_InputIterator>>
75 template<
typename _InputIterator>
77 set(_InputIterator __first, _InputIterator __last,
78 const _Compare& __comp = _Compare(),
79 const _Allocator& __a = _Allocator())
80 : _Base(__first, __last, __comp, __a) { }
88 #if __cplusplus >= 201103L
90 noexcept(is_nothrow_copy_constructible<_Compare>::value)
94 set(initializer_list<value_type> __l,
95 const _Compare& __comp = _Compare(),
96 const allocator_type& __a = allocator_type())
97 : _Base(__l, __comp, __a) { }
100 ~set() _GLIBCXX_NOEXCEPT { }
103 operator=(
const set& __x)
105 *
static_cast<_Base*
>(
this) = __x;
109 #if __cplusplus >= 201103L
121 operator=(initializer_list<value_type> __l)
129 using _Base::get_allocator;
133 begin() _GLIBCXX_NOEXCEPT
134 {
return iterator(_Base::begin()); }
137 begin()
const _GLIBCXX_NOEXCEPT
138 {
return const_iterator(_Base::begin()); }
141 end() _GLIBCXX_NOEXCEPT
142 {
return iterator(_Base::end()); }
145 end()
const _GLIBCXX_NOEXCEPT
146 {
return const_iterator(_Base::end()); }
149 rbegin() _GLIBCXX_NOEXCEPT
150 {
return reverse_iterator(end()); }
152 const_reverse_iterator
153 rbegin()
const _GLIBCXX_NOEXCEPT
154 {
return const_reverse_iterator(end()); }
157 rend() _GLIBCXX_NOEXCEPT
158 {
return reverse_iterator(begin()); }
160 const_reverse_iterator
161 rend()
const _GLIBCXX_NOEXCEPT
162 {
return const_reverse_iterator(begin()); }
164 #if __cplusplus >= 201103L
166 cbegin()
const noexcept
167 {
return const_iterator(_Base::begin()); }
170 cend()
const noexcept
171 {
return const_iterator(_Base::end()); }
173 const_reverse_iterator
174 crbegin()
const noexcept
175 {
return const_reverse_iterator(end()); }
177 const_reverse_iterator
178 crend()
const noexcept
179 {
return const_reverse_iterator(begin()); }
185 using _Base::max_size;
188 #if __cplusplus >= 201103L
189 template<
typename... _Args>
191 emplace(_Args&&... __args)
193 auto __res = _Base::emplace(std::forward<_Args>(__args)...);
198 template<
typename... _Args>
200 emplace_hint(const_iterator __pos, _Args&&... __args)
202 return iterator(_Base::emplace_hint(__pos,
203 std::forward<_Args>(__args)...));
208 insert(
const value_type& __x)
210 typedef typename _Base::iterator _Base_iterator;
216 #if __cplusplus >= 201103L
218 insert(value_type&& __x)
220 typedef typename _Base::iterator _Base_iterator;
229 insert(const_iterator __position,
const value_type& __x)
230 {
return iterator(_Base::insert(__position, __x)); }
232 #if __cplusplus >= 201103L
234 insert(const_iterator __position, value_type&& __x)
235 {
return iterator(_Base::insert(__position,
std::move(__x))); }
238 #if __cplusplus >= 201103L
239 template<
typename _InputIterator,
240 typename = std::_RequireInputIter<_InputIterator>>
242 template<
typename _InputIterator>
245 insert(_InputIterator __first, _InputIterator __last)
246 { _Base::insert(__first, __last); }
248 #if __cplusplus >= 201103L
250 insert(initializer_list<value_type> __l)
251 { _Base::insert(__l); }
254 #if __cplusplus >= 201103L
256 erase(const_iterator __position)
257 {
return iterator(_Base::erase(__position)); }
260 erase(iterator __position)
261 { _Base::erase(__position); }
265 erase(
const key_type& __x)
267 iterator __victim = find(__x);
268 if (__victim == end())
272 _Base::erase(__victim);
277 #if __cplusplus >= 201103L
279 erase(const_iterator __first, const_iterator __last)
280 {
return iterator(_Base::erase(__first, __last)); }
283 erase(iterator __first, iterator __last)
284 { _Base::erase(__first, __last); }
289 { _Base::swap(__x); }
292 clear() _GLIBCXX_NOEXCEPT
293 { this->erase(begin(), end()); }
296 using _Base::key_comp;
297 using _Base::value_comp;
301 find(
const key_type& __x)
302 {
return iterator(_Base::find(__x)); }
307 find(
const key_type& __x)
const
308 {
return const_iterator(_Base::find(__x)); }
313 lower_bound(
const key_type& __x)
314 {
return iterator(_Base::lower_bound(__x)); }
319 lower_bound(
const key_type& __x)
const
320 {
return const_iterator(_Base::lower_bound(__x)); }
323 upper_bound(
const key_type& __x)
324 {
return iterator(_Base::upper_bound(__x)); }
329 upper_bound(
const key_type& __x)
const
330 {
return const_iterator(_Base::upper_bound(__x)); }
333 equal_range(
const key_type& __x)
335 typedef typename _Base::iterator _Base_iterator;
337 _Base::equal_range(__x);
345 equal_range(
const key_type& __x)
const
347 typedef typename _Base::const_iterator _Base_iterator;
349 _Base::equal_range(__x);
351 const_iterator(__res.
second));
355 _M_base() _GLIBCXX_NOEXCEPT {
return *
this; }
358 _M_base()
const _GLIBCXX_NOEXCEPT {
return *
this; }
362 template<
typename _Key,
typename _Compare,
typename _Allocator>
366 {
return __lhs._M_base() == __rhs._M_base(); }
368 template<
typename _Key,
typename _Compare,
typename _Allocator>
372 {
return __lhs._M_base() != __rhs._M_base(); }
374 template<
typename _Key,
typename _Compare,
typename _Allocator>
376 operator<(const set<_Key, _Compare, _Allocator>& __lhs,
377 const set<_Key, _Compare, _Allocator>& __rhs)
378 {
return __lhs._M_base() < __rhs._M_base(); }
380 template<
typename _Key,
typename _Compare,
typename _Allocator>
382 operator<=(const set<_Key, _Compare, _Allocator>& __lhs,
383 const set<_Key, _Compare, _Allocator>& __rhs)
384 {
return __lhs._M_base() <= __rhs._M_base(); }
386 template<
typename _Key,
typename _Compare,
typename _Allocator>
388 operator>=(
const set<_Key, _Compare, _Allocator>& __lhs,
389 const set<_Key, _Compare, _Allocator>& __rhs)
390 {
return __lhs._M_base() >= __rhs._M_base(); }
392 template<
typename _Key,
typename _Compare,
typename _Allocator>
394 operator>(
const set<_Key, _Compare, _Allocator>& __lhs,
395 const set<_Key, _Compare, _Allocator>& __rhs)
396 {
return __lhs._M_base() > __rhs._M_base(); }
398 template<
typename _Key,
typename _Compare,
typename _Allocator>
400 swap(set<_Key, _Compare, _Allocator>& __x,
401 set<_Key, _Compare, _Allocator>& __y)
402 {
return __x.swap(__y); }
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
bool operator>=(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string doesn't precede string.
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.
ISO C++ entities toplevel namespace is std.
_T1 first
second_type is the second bound type
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...
Struct holding two objects of arbitrary type.
Class std::set wrapper with performance instrumentation.
_T2 second
first is a copy of the first object
bool operator>(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string follows string.