comparison DEPENDENCIES/generic/include/boost/intrusive/sg_set.hpp @ 16:2665513ce2d3

Add boost headers
author Chris Cannam
date Tue, 05 Aug 2014 11:11:38 +0100
parents
children c530137014c0
comparison
equal deleted inserted replaced
15:663ca0da4350 16:2665513ce2d3
1 /////////////////////////////////////////////////////////////////////////////
2 //
3 // (C) Copyright Ion Gaztanaga 2007-2013
4 //
5 // Distributed under the Boost Software License, Version 1.0.
6 // (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
8 //
9 // See http://www.boost.org/libs/intrusive for documentation.
10 //
11 /////////////////////////////////////////////////////////////////////////////
12 #ifndef BOOST_INTRUSIVE_SG_SET_HPP
13 #define BOOST_INTRUSIVE_SG_SET_HPP
14
15 #include <boost/intrusive/detail/config_begin.hpp>
16 #include <boost/intrusive/intrusive_fwd.hpp>
17 #include <boost/intrusive/detail/mpl.hpp>
18 #include <boost/intrusive/sgtree.hpp>
19 #include <iterator>
20 #include <boost/move/move.hpp>
21
22 namespace boost {
23 namespace intrusive {
24
25 //! The class template sg_set is an intrusive container, that mimics most of
26 //! the interface of std::sg_set as described in the C++ standard.
27 //!
28 //! The template parameter \c T is the type to be managed by the container.
29 //! The user can specify additional options and if no options are provided
30 //! default options are used.
31 //!
32 //! The container supports the following options:
33 //! \c base_hook<>/member_hook<>/value_traits<>,
34 //! \c floating_point<>, \c size_type<> and
35 //! \c compare<>.
36 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
37 template<class T, class ...Options>
38 #else
39 template<class ValueTraits, class Compare, class SizeType, bool FloatingPoint>
40 #endif
41 class sg_set_impl
42 #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
43 : public sgtree_impl<ValueTraits, Compare, SizeType, FloatingPoint>
44 #endif
45 {
46 /// @cond
47 typedef sgtree_impl<ValueTraits, Compare, SizeType, FloatingPoint> tree_type;
48 BOOST_MOVABLE_BUT_NOT_COPYABLE(sg_set_impl)
49
50 typedef tree_type implementation_defined;
51 /// @endcond
52
53 public:
54 typedef typename implementation_defined::value_type value_type;
55 typedef typename implementation_defined::value_traits value_traits;
56 typedef typename implementation_defined::pointer pointer;
57 typedef typename implementation_defined::const_pointer const_pointer;
58 typedef typename implementation_defined::reference reference;
59 typedef typename implementation_defined::const_reference const_reference;
60 typedef typename implementation_defined::difference_type difference_type;
61 typedef typename implementation_defined::size_type size_type;
62 typedef typename implementation_defined::value_compare value_compare;
63 typedef typename implementation_defined::key_compare key_compare;
64 typedef typename implementation_defined::iterator iterator;
65 typedef typename implementation_defined::const_iterator const_iterator;
66 typedef typename implementation_defined::reverse_iterator reverse_iterator;
67 typedef typename implementation_defined::const_reverse_iterator const_reverse_iterator;
68 typedef typename implementation_defined::insert_commit_data insert_commit_data;
69 typedef typename implementation_defined::node_traits node_traits;
70 typedef typename implementation_defined::node node;
71 typedef typename implementation_defined::node_ptr node_ptr;
72 typedef typename implementation_defined::const_node_ptr const_node_ptr;
73 typedef typename implementation_defined::node_algorithms node_algorithms;
74
75 static const bool constant_time_size = tree_type::constant_time_size;
76
77 public:
78 //! @copydoc ::boost::intrusive::sgtree::sgtree(const value_compare &,const value_traits &)
79 explicit sg_set_impl( const value_compare &cmp = value_compare()
80 , const value_traits &v_traits = value_traits())
81 : tree_type(cmp, v_traits)
82 {}
83
84 //! @copydoc ::boost::intrusive::sgtree::sgtree(bool,Iterator,Iterator,const value_compare &,const value_traits &)
85 template<class Iterator>
86 sg_set_impl( Iterator b, Iterator e
87 , const value_compare &cmp = value_compare()
88 , const value_traits &v_traits = value_traits())
89 : tree_type(true, b, e, cmp, v_traits)
90 {}
91
92 //! @copydoc ::boost::intrusive::sgtree::sgtree(sgtree &&)
93 sg_set_impl(BOOST_RV_REF(sg_set_impl) x)
94 : tree_type(::boost::move(static_cast<tree_type&>(x)))
95 {}
96
97 //! @copydoc ::boost::intrusive::sgtree::operator=(sgtree &&)
98 sg_set_impl& operator=(BOOST_RV_REF(sg_set_impl) x)
99 { return static_cast<sg_set_impl&>(tree_type::operator=(::boost::move(static_cast<tree_type&>(x)))); }
100
101 #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
102 //! @copydoc ::boost::intrusive::sgtree::~sgtree()
103 ~sg_set_impl();
104
105 //! @copydoc ::boost::intrusive::sgtree::begin()
106 iterator begin();
107
108 //! @copydoc ::boost::intrusive::sgtree::begin()const
109 const_iterator begin() const;
110
111 //! @copydoc ::boost::intrusive::sgtree::cbegin()const
112 const_iterator cbegin() const;
113
114 //! @copydoc ::boost::intrusive::sgtree::end()
115 iterator end();
116
117 //! @copydoc ::boost::intrusive::sgtree::end()const
118 const_iterator end() const;
119
120 //! @copydoc ::boost::intrusive::sgtree::cend()const
121 const_iterator cend() const;
122
123 //! @copydoc ::boost::intrusive::sgtree::rbegin()
124 reverse_iterator rbegin();
125
126 //! @copydoc ::boost::intrusive::sgtree::rbegin()const
127 const_reverse_iterator rbegin() const;
128
129 //! @copydoc ::boost::intrusive::sgtree::crbegin()const
130 const_reverse_iterator crbegin() const;
131
132 //! @copydoc ::boost::intrusive::sgtree::rend()
133 reverse_iterator rend();
134
135 //! @copydoc ::boost::intrusive::sgtree::rend()const
136 const_reverse_iterator rend() const;
137
138 //! @copydoc ::boost::intrusive::sgtree::crend()const
139 const_reverse_iterator crend() const;
140
141 //! @copydoc ::boost::intrusive::sgtree::container_from_end_iterator(iterator)
142 static sg_set_impl &container_from_end_iterator(iterator end_iterator);
143
144 //! @copydoc ::boost::intrusive::sgtree::container_from_end_iterator(const_iterator)
145 static const sg_set_impl &container_from_end_iterator(const_iterator end_iterator);
146
147 //! @copydoc ::boost::intrusive::sgtree::container_from_iterator(iterator)
148 static sg_set_impl &container_from_iterator(iterator it);
149
150 //! @copydoc ::boost::intrusive::sgtree::container_from_iterator(const_iterator)
151 static const sg_set_impl &container_from_iterator(const_iterator it);
152
153 //! @copydoc ::boost::intrusive::sgtree::key_comp()const
154 key_compare key_comp() const;
155
156 //! @copydoc ::boost::intrusive::sgtree::value_comp()const
157 value_compare value_comp() const;
158
159 //! @copydoc ::boost::intrusive::sgtree::empty()const
160 bool empty() const;
161
162 //! @copydoc ::boost::intrusive::sgtree::size()const
163 size_type size() const;
164
165 //! @copydoc ::boost::intrusive::sgtree::swap
166 void swap(sg_set_impl& other);
167
168 //! @copydoc ::boost::intrusive::sgtree::clone_from
169 template <class Cloner, class Disposer>
170 void clone_from(const sg_set_impl &src, Cloner cloner, Disposer disposer);
171
172 #endif //#ifdef BOOST_iNTRUSIVE_DOXYGEN_INVOKED
173
174 //! @copydoc ::boost::intrusive::sgtree::insert_unique(reference)
175 std::pair<iterator, bool> insert(reference value)
176 { return tree_type::insert_unique(value); }
177
178 //! @copydoc ::boost::intrusive::sgtree::insert_unique(const_iterator,reference)
179 iterator insert(const_iterator hint, reference value)
180 { return tree_type::insert_unique(hint, value); }
181
182 //! @copydoc ::boost::intrusive::sgtree::insert_unique_check(const KeyType&,KeyValueCompare,insert_commit_data&)
183 template<class KeyType, class KeyValueCompare>
184 std::pair<iterator, bool> insert_check
185 (const KeyType &key, KeyValueCompare key_value_comp, insert_commit_data &commit_data)
186 { return tree_type::insert_unique_check(key, key_value_comp, commit_data); }
187
188 //! @copydoc ::boost::intrusive::sgtree::insert_unique_check(const_iterator,const KeyType&,KeyValueCompare,insert_commit_data&)
189 template<class KeyType, class KeyValueCompare>
190 std::pair<iterator, bool> insert_check
191 (const_iterator hint, const KeyType &key
192 ,KeyValueCompare key_value_comp, insert_commit_data &commit_data)
193 { return tree_type::insert_unique_check(hint, key, key_value_comp, commit_data); }
194
195 //! @copydoc ::boost::intrusive::sgtree::insert_unique(Iterator,Iterator)
196 template<class Iterator>
197 void insert(Iterator b, Iterator e)
198 { tree_type::insert_unique(b, e); }
199
200 //! @copydoc ::boost::intrusive::sgtree::insert_unique_commit
201 iterator insert_commit(reference value, const insert_commit_data &commit_data)
202 { return tree_type::insert_unique_commit(value, commit_data); }
203
204 #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
205 //! @copydoc ::boost::intrusive::sgtree::insert_before
206 iterator insert_before(const_iterator pos, reference value);
207
208 //! @copydoc ::boost::intrusive::sgtree::push_back
209 void push_back(reference value);
210
211 //! @copydoc ::boost::intrusive::sgtree::push_front
212 void push_front(reference value);
213
214 //! @copydoc ::boost::intrusive::sgtree::erase(const_iterator)
215 iterator erase(const_iterator i);
216
217 //! @copydoc ::boost::intrusive::sgtree::erase(const_iterator,const_iterator)
218 iterator erase(const_iterator b, const_iterator e);
219
220 //! @copydoc ::boost::intrusive::sgtree::erase(const_reference)
221 size_type erase(const_reference value);
222
223 //! @copydoc ::boost::intrusive::sgtree::erase(const KeyType&,KeyValueCompare)
224 template<class KeyType, class KeyValueCompare>
225 size_type erase(const KeyType& key, KeyValueCompare comp);
226
227 //! @copydoc ::boost::intrusive::sgtree::erase_and_dispose(const_iterator,Disposer)
228 template<class Disposer>
229 iterator erase_and_dispose(const_iterator i, Disposer disposer);
230
231 //! @copydoc ::boost::intrusive::sgtree::erase_and_dispose(const_iterator,const_iterator,Disposer)
232 template<class Disposer>
233 iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer);
234
235 //! @copydoc ::boost::intrusive::sgtree::erase_and_dispose(const_reference, Disposer)
236 template<class Disposer>
237 size_type erase_and_dispose(const_reference value, Disposer disposer);
238
239 //! @copydoc ::boost::intrusive::sgtree::erase_and_dispose(const KeyType&,KeyValueCompare,Disposer)
240 template<class KeyType, class KeyValueCompare, class Disposer>
241 size_type erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer);
242
243 //! @copydoc ::boost::intrusive::sgtree::clear
244 void clear();
245
246 //! @copydoc ::boost::intrusive::sgtree::clear_and_dispose
247 template<class Disposer>
248 void clear_and_dispose(Disposer disposer);
249
250 //! @copydoc ::boost::intrusive::sgtree::count(const_reference)const
251 size_type count(const_reference value) const;
252
253 //! @copydoc ::boost::intrusive::sgtree::count(const KeyType&,KeyValueCompare)const
254 template<class KeyType, class KeyValueCompare>
255 size_type count(const KeyType& key, KeyValueCompare comp) const;
256
257 //! @copydoc ::boost::intrusive::sgtree::lower_bound(const_reference)
258 iterator lower_bound(const_reference value);
259
260 //! @copydoc ::boost::intrusive::sgtree::lower_bound(const KeyType&,KeyValueCompare)
261 template<class KeyType, class KeyValueCompare>
262 iterator lower_bound(const KeyType& key, KeyValueCompare comp);
263
264 //! @copydoc ::boost::intrusive::sgtree::lower_bound(const_reference)const
265 const_iterator lower_bound(const_reference value) const;
266
267 //! @copydoc ::boost::intrusive::sgtree::lower_bound(const KeyType&,KeyValueCompare)const
268 template<class KeyType, class KeyValueCompare>
269 const_iterator lower_bound(const KeyType& key, KeyValueCompare comp) const;
270
271 //! @copydoc ::boost::intrusive::sgtree::upper_bound(const_reference)
272 iterator upper_bound(const_reference value);
273
274 //! @copydoc ::boost::intrusive::sgtree::upper_bound(const KeyType&,KeyValueCompare)
275 template<class KeyType, class KeyValueCompare>
276 iterator upper_bound(const KeyType& key, KeyValueCompare comp);
277
278 //! @copydoc ::boost::intrusive::sgtree::upper_bound(const_reference)const
279 const_iterator upper_bound(const_reference value) const;
280
281 //! @copydoc ::boost::intrusive::sgtree::upper_bound(const KeyType&,KeyValueCompare)const
282 template<class KeyType, class KeyValueCompare>
283 const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const;
284
285 //! @copydoc ::boost::intrusive::sgtree::find(const_reference)
286 iterator find(const_reference value);
287
288 //! @copydoc ::boost::intrusive::sgtree::find(const KeyType&,KeyValueCompare)
289 template<class KeyType, class KeyValueCompare>
290 iterator find(const KeyType& key, KeyValueCompare comp);
291
292 //! @copydoc ::boost::intrusive::sgtree::find(const_reference)const
293 const_iterator find(const_reference value) const;
294
295 //! @copydoc ::boost::intrusive::sgtree::find(const KeyType&,KeyValueCompare)const
296 template<class KeyType, class KeyValueCompare>
297 const_iterator find(const KeyType& key, KeyValueCompare comp) const;
298
299 //! @copydoc ::boost::intrusive::sgtree::equal_range(const_reference)
300 std::pair<iterator,iterator> equal_range(const_reference value);
301
302 //! @copydoc ::boost::intrusive::sgtree::equal_range(const KeyType&,KeyValueCompare)
303 template<class KeyType, class KeyValueCompare>
304 std::pair<iterator,iterator> equal_range(const KeyType& key, KeyValueCompare comp);
305
306 //! @copydoc ::boost::intrusive::sgtree::equal_range(const_reference)const
307 std::pair<const_iterator, const_iterator>
308 equal_range(const_reference value) const;
309
310 //! @copydoc ::boost::intrusive::sgtree::equal_range(const KeyType&,KeyValueCompare)const
311 template<class KeyType, class KeyValueCompare>
312 std::pair<const_iterator, const_iterator>
313 equal_range(const KeyType& key, KeyValueCompare comp) const;
314
315 //! @copydoc ::boost::intrusive::sgtree::bounded_range(const_reference,const_reference,bool,bool)
316 std::pair<iterator,iterator> bounded_range
317 (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed);
318
319 //! @copydoc ::boost::intrusive::sgtree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)
320 template<class KeyType, class KeyValueCompare>
321 std::pair<iterator,iterator> bounded_range
322 (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed);
323
324 //! @copydoc ::boost::intrusive::sgtree::bounded_range(const_reference,const_reference,bool,bool)const
325 std::pair<const_iterator, const_iterator>
326 bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const;
327
328 //! @copydoc ::boost::intrusive::sgtree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)const
329 template<class KeyType, class KeyValueCompare>
330 std::pair<const_iterator, const_iterator> bounded_range
331 (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const;
332
333 //! @copydoc ::boost::intrusive::sgtree::s_iterator_to(reference)
334 static iterator s_iterator_to(reference value);
335
336 //! @copydoc ::boost::intrusive::sgtree::s_iterator_to(const_reference)
337 static const_iterator s_iterator_to(const_reference value);
338
339 //! @copydoc ::boost::intrusive::sgtree::iterator_to(reference)
340 iterator iterator_to(reference value);
341
342 //! @copydoc ::boost::intrusive::sgtree::iterator_to(const_reference)const
343 const_iterator iterator_to(const_reference value) const;
344
345 //! @copydoc ::boost::intrusive::sgtree::init_node(reference)
346 static void init_node(reference value);
347
348 //! @copydoc ::boost::intrusive::sgtree::unlink_leftmost_without_rebalance
349 pointer unlink_leftmost_without_rebalance();
350
351 //! @copydoc ::boost::intrusive::sgtree::replace_node
352 void replace_node(iterator replace_this, reference with_this);
353
354 //! @copydoc ::boost::intrusive::sgtree::remove_node
355 void remove_node(reference value);
356
357 //! @copydoc ::boost::intrusive::sgtree::rebalance
358 void rebalance();
359
360 //! @copydoc ::boost::intrusive::sgtree::rebalance_subtree
361 iterator rebalance_subtree(iterator root);
362
363 //! @copydoc ::boost::intrusive::sgtree::balance_factor()
364 float balance_factor() const;
365
366 //! @copydoc ::boost::intrusive::sgtree::balance_factor(float)
367 void balance_factor(float new_alpha);
368
369 #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
370 };
371
372 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
373
374 template<class T, class ...Options>
375 bool operator!= (const sg_set_impl<T, Options...> &x, const sg_set_impl<T, Options...> &y);
376
377 template<class T, class ...Options>
378 bool operator>(const sg_set_impl<T, Options...> &x, const sg_set_impl<T, Options...> &y);
379
380 template<class T, class ...Options>
381 bool operator<=(const sg_set_impl<T, Options...> &x, const sg_set_impl<T, Options...> &y);
382
383 template<class T, class ...Options>
384 bool operator>=(const sg_set_impl<T, Options...> &x, const sg_set_impl<T, Options...> &y);
385
386 template<class T, class ...Options>
387 void swap(sg_set_impl<T, Options...> &x, sg_set_impl<T, Options...> &y);
388
389 #endif //#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
390
391 //! Helper metafunction to define a \c sg_set that yields to the same type when the
392 //! same options (either explicitly or implicitly) are used.
393 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
394 template<class T, class ...Options>
395 #else
396 template<class T, class O1 = void, class O2 = void
397 , class O3 = void, class O4 = void>
398 #endif
399 struct make_sg_set
400 {
401 /// @cond
402 typedef typename pack_options
403 < sgtree_defaults,
404 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
405 O1, O2, O3, O4
406 #else
407 Options...
408 #endif
409 >::type packed_options;
410
411 typedef typename detail::get_value_traits
412 <T, typename packed_options::proto_value_traits>::type value_traits;
413
414 typedef sg_set_impl
415 < value_traits
416 , typename packed_options::compare
417 , typename packed_options::size_type
418 , packed_options::floating_point
419 > implementation_defined;
420 /// @endcond
421 typedef implementation_defined type;
422 };
423
424 #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
425 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
426 template<class T, class O1, class O2, class O3, class O4>
427 #else
428 template<class T, class ...Options>
429 #endif
430 class sg_set
431 : public make_sg_set<T,
432 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
433 O1, O2, O3, O4
434 #else
435 Options...
436 #endif
437 >::type
438 {
439 typedef typename make_sg_set
440 <T,
441 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
442 O1, O2, O3, O4
443 #else
444 Options...
445 #endif
446 >::type Base;
447
448 BOOST_MOVABLE_BUT_NOT_COPYABLE(sg_set)
449 public:
450 typedef typename Base::value_compare value_compare;
451 typedef typename Base::value_traits value_traits;
452 typedef typename Base::iterator iterator;
453 typedef typename Base::const_iterator const_iterator;
454
455 //Assert if passed value traits are compatible with the type
456 BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
457
458 explicit sg_set( const value_compare &cmp = value_compare()
459 , const value_traits &v_traits = value_traits())
460 : Base(cmp, v_traits)
461 {}
462
463 template<class Iterator>
464 sg_set( Iterator b, Iterator e
465 , const value_compare &cmp = value_compare()
466 , const value_traits &v_traits = value_traits())
467 : Base(b, e, cmp, v_traits)
468 {}
469
470 sg_set(BOOST_RV_REF(sg_set) x)
471 : Base(::boost::move(static_cast<Base&>(x)))
472 {}
473
474 sg_set& operator=(BOOST_RV_REF(sg_set) x)
475 { return static_cast<sg_set &>(this->Base::operator=(::boost::move(static_cast<Base&>(x)))); }
476
477 static sg_set &container_from_end_iterator(iterator end_iterator)
478 { return static_cast<sg_set &>(Base::container_from_end_iterator(end_iterator)); }
479
480 static const sg_set &container_from_end_iterator(const_iterator end_iterator)
481 { return static_cast<const sg_set &>(Base::container_from_end_iterator(end_iterator)); }
482
483 static sg_set &container_from_iterator(iterator it)
484 { return static_cast<sg_set &>(Base::container_from_iterator(it)); }
485
486 static const sg_set &container_from_iterator(const_iterator it)
487 { return static_cast<const sg_set &>(Base::container_from_iterator(it)); }
488 };
489
490 #endif
491
492 //! The class template sg_multiset is an intrusive container, that mimics most of
493 //! the interface of std::sg_multiset as described in the C++ standard.
494 //!
495 //! The template parameter \c T is the type to be managed by the container.
496 //! The user can specify additional options and if no options are provided
497 //! default options are used.
498 //!
499 //! The container supports the following options:
500 //! \c base_hook<>/member_hook<>/value_traits<>,
501 //! \c floating_point<>, \c size_type<> and
502 //! \c compare<>.
503 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
504 template<class T, class ...Options>
505 #else
506 template<class ValueTraits, class Compare, class SizeType, bool FloatingPoint>
507 #endif
508 class sg_multiset_impl
509 #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
510 : public sgtree_impl<ValueTraits, Compare, SizeType, FloatingPoint>
511 #endif
512 {
513 /// @cond
514 typedef sgtree_impl<ValueTraits, Compare, SizeType, FloatingPoint> tree_type;
515
516 BOOST_MOVABLE_BUT_NOT_COPYABLE(sg_multiset_impl)
517 typedef tree_type implementation_defined;
518 /// @endcond
519
520 public:
521 typedef typename implementation_defined::value_type value_type;
522 typedef typename implementation_defined::value_traits value_traits;
523 typedef typename implementation_defined::pointer pointer;
524 typedef typename implementation_defined::const_pointer const_pointer;
525 typedef typename implementation_defined::reference reference;
526 typedef typename implementation_defined::const_reference const_reference;
527 typedef typename implementation_defined::difference_type difference_type;
528 typedef typename implementation_defined::size_type size_type;
529 typedef typename implementation_defined::value_compare value_compare;
530 typedef typename implementation_defined::key_compare key_compare;
531 typedef typename implementation_defined::iterator iterator;
532 typedef typename implementation_defined::const_iterator const_iterator;
533 typedef typename implementation_defined::reverse_iterator reverse_iterator;
534 typedef typename implementation_defined::const_reverse_iterator const_reverse_iterator;
535 typedef typename implementation_defined::insert_commit_data insert_commit_data;
536 typedef typename implementation_defined::node_traits node_traits;
537 typedef typename implementation_defined::node node;
538 typedef typename implementation_defined::node_ptr node_ptr;
539 typedef typename implementation_defined::const_node_ptr const_node_ptr;
540 typedef typename implementation_defined::node_algorithms node_algorithms;
541
542 static const bool constant_time_size = tree_type::constant_time_size;
543
544 public:
545 //! @copydoc ::boost::intrusive::sgtree::sgtree(const value_compare &,const value_traits &)
546 explicit sg_multiset_impl( const value_compare &cmp = value_compare()
547 , const value_traits &v_traits = value_traits())
548 : tree_type(cmp, v_traits)
549 {}
550
551 //! @copydoc ::boost::intrusive::sgtree::sgtree(bool,Iterator,Iterator,const value_compare &,const value_traits &)
552 template<class Iterator>
553 sg_multiset_impl( Iterator b, Iterator e
554 , const value_compare &cmp = value_compare()
555 , const value_traits &v_traits = value_traits())
556 : tree_type(false, b, e, cmp, v_traits)
557 {}
558
559 //! @copydoc ::boost::intrusive::sgtree::sgtree(sgtree &&)
560 sg_multiset_impl(BOOST_RV_REF(sg_multiset_impl) x)
561 : tree_type(::boost::move(static_cast<tree_type&>(x)))
562 {}
563
564 //! @copydoc ::boost::intrusive::sgtree::operator=(sgtree &&)
565 sg_multiset_impl& operator=(BOOST_RV_REF(sg_multiset_impl) x)
566 { return static_cast<sg_multiset_impl&>(tree_type::operator=(::boost::move(static_cast<tree_type&>(x)))); }
567
568 #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
569 //! @copydoc ::boost::intrusive::sgtree::~sgtree()
570 ~sg_multiset_impl();
571
572 //! @copydoc ::boost::intrusive::sgtree::begin()
573 iterator begin();
574
575 //! @copydoc ::boost::intrusive::sgtree::begin()const
576 const_iterator begin() const;
577
578 //! @copydoc ::boost::intrusive::sgtree::cbegin()const
579 const_iterator cbegin() const;
580
581 //! @copydoc ::boost::intrusive::sgtree::end()
582 iterator end();
583
584 //! @copydoc ::boost::intrusive::sgtree::end()const
585 const_iterator end() const;
586
587 //! @copydoc ::boost::intrusive::sgtree::cend()const
588 const_iterator cend() const;
589
590 //! @copydoc ::boost::intrusive::sgtree::rbegin()
591 reverse_iterator rbegin();
592
593 //! @copydoc ::boost::intrusive::sgtree::rbegin()const
594 const_reverse_iterator rbegin() const;
595
596 //! @copydoc ::boost::intrusive::sgtree::crbegin()const
597 const_reverse_iterator crbegin() const;
598
599 //! @copydoc ::boost::intrusive::sgtree::rend()
600 reverse_iterator rend();
601
602 //! @copydoc ::boost::intrusive::sgtree::rend()const
603 const_reverse_iterator rend() const;
604
605 //! @copydoc ::boost::intrusive::sgtree::crend()const
606 const_reverse_iterator crend() const;
607
608 //! @copydoc ::boost::intrusive::sgtree::container_from_end_iterator(iterator)
609 static sg_multiset_impl &container_from_end_iterator(iterator end_iterator);
610
611 //! @copydoc ::boost::intrusive::sgtree::container_from_end_iterator(const_iterator)
612 static const sg_multiset_impl &container_from_end_iterator(const_iterator end_iterator);
613
614 //! @copydoc ::boost::intrusive::sgtree::container_from_iterator(iterator)
615 static sg_multiset_impl &container_from_iterator(iterator it);
616
617 //! @copydoc ::boost::intrusive::sgtree::container_from_iterator(const_iterator)
618 static const sg_multiset_impl &container_from_iterator(const_iterator it);
619
620 //! @copydoc ::boost::intrusive::sgtree::key_comp()const
621 key_compare key_comp() const;
622
623 //! @copydoc ::boost::intrusive::sgtree::value_comp()const
624 value_compare value_comp() const;
625
626 //! @copydoc ::boost::intrusive::sgtree::empty()const
627 bool empty() const;
628
629 //! @copydoc ::boost::intrusive::sgtree::size()const
630 size_type size() const;
631
632 //! @copydoc ::boost::intrusive::sgtree::swap
633 void swap(sg_multiset_impl& other);
634
635 //! @copydoc ::boost::intrusive::sgtree::clone_from
636 template <class Cloner, class Disposer>
637 void clone_from(const sg_multiset_impl &src, Cloner cloner, Disposer disposer);
638
639 #endif //#ifdef BOOST_iNTRUSIVE_DOXYGEN_INVOKED
640
641 //! @copydoc ::boost::intrusive::sgtree::insert_equal(reference)
642 iterator insert(reference value)
643 { return tree_type::insert_equal(value); }
644
645 //! @copydoc ::boost::intrusive::sgtree::insert_equal(const_iterator,reference)
646 iterator insert(const_iterator hint, reference value)
647 { return tree_type::insert_equal(hint, value); }
648
649 //! @copydoc ::boost::intrusive::sgtree::insert_equal(Iterator,Iterator)
650 template<class Iterator>
651 void insert(Iterator b, Iterator e)
652 { tree_type::insert_equal(b, e); }
653
654 #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
655 //! @copydoc ::boost::intrusive::sgtree::insert_before
656 iterator insert_before(const_iterator pos, reference value);
657
658 //! @copydoc ::boost::intrusive::sgtree::push_back
659 void push_back(reference value);
660
661 //! @copydoc ::boost::intrusive::sgtree::push_front
662 void push_front(reference value);
663
664 //! @copydoc ::boost::intrusive::sgtree::erase(const_iterator)
665 iterator erase(const_iterator i);
666
667 //! @copydoc ::boost::intrusive::sgtree::erase(const_iterator,const_iterator)
668 iterator erase(const_iterator b, const_iterator e);
669
670 //! @copydoc ::boost::intrusive::sgtree::erase(const_reference)
671 size_type erase(const_reference value);
672
673 //! @copydoc ::boost::intrusive::sgtree::erase(const KeyType&,KeyValueCompare)
674 template<class KeyType, class KeyValueCompare>
675 size_type erase(const KeyType& key, KeyValueCompare comp);
676
677 //! @copydoc ::boost::intrusive::sgtree::erase_and_dispose(const_iterator,Disposer)
678 template<class Disposer>
679 iterator erase_and_dispose(const_iterator i, Disposer disposer);
680
681 //! @copydoc ::boost::intrusive::sgtree::erase_and_dispose(const_iterator,const_iterator,Disposer)
682 template<class Disposer>
683 iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer);
684
685 //! @copydoc ::boost::intrusive::sgtree::erase_and_dispose(const_reference, Disposer)
686 template<class Disposer>
687 size_type erase_and_dispose(const_reference value, Disposer disposer);
688
689 //! @copydoc ::boost::intrusive::sgtree::erase_and_dispose(const KeyType&,KeyValueCompare,Disposer)
690 template<class KeyType, class KeyValueCompare, class Disposer>
691 size_type erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer);
692
693 //! @copydoc ::boost::intrusive::sgtree::clear
694 void clear();
695
696 //! @copydoc ::boost::intrusive::sgtree::clear_and_dispose
697 template<class Disposer>
698 void clear_and_dispose(Disposer disposer);
699
700 //! @copydoc ::boost::intrusive::sgtree::count(const_reference)const
701 size_type count(const_reference value) const;
702
703 //! @copydoc ::boost::intrusive::sgtree::count(const KeyType&,KeyValueCompare)const
704 template<class KeyType, class KeyValueCompare>
705 size_type count(const KeyType& key, KeyValueCompare comp) const;
706
707 //! @copydoc ::boost::intrusive::sgtree::lower_bound(const_reference)
708 iterator lower_bound(const_reference value);
709
710 //! @copydoc ::boost::intrusive::sgtree::lower_bound(const KeyType&,KeyValueCompare)
711 template<class KeyType, class KeyValueCompare>
712 iterator lower_bound(const KeyType& key, KeyValueCompare comp);
713
714 //! @copydoc ::boost::intrusive::sgtree::lower_bound(const_reference)const
715 const_iterator lower_bound(const_reference value) const;
716
717 //! @copydoc ::boost::intrusive::sgtree::lower_bound(const KeyType&,KeyValueCompare)const
718 template<class KeyType, class KeyValueCompare>
719 const_iterator lower_bound(const KeyType& key, KeyValueCompare comp) const;
720
721 //! @copydoc ::boost::intrusive::sgtree::upper_bound(const_reference)
722 iterator upper_bound(const_reference value);
723
724 //! @copydoc ::boost::intrusive::sgtree::upper_bound(const KeyType&,KeyValueCompare)
725 template<class KeyType, class KeyValueCompare>
726 iterator upper_bound(const KeyType& key, KeyValueCompare comp);
727
728 //! @copydoc ::boost::intrusive::sgtree::upper_bound(const_reference)const
729 const_iterator upper_bound(const_reference value) const;
730
731 //! @copydoc ::boost::intrusive::sgtree::upper_bound(const KeyType&,KeyValueCompare)const
732 template<class KeyType, class KeyValueCompare>
733 const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const;
734
735 //! @copydoc ::boost::intrusive::sgtree::find(const_reference)
736 iterator find(const_reference value);
737
738 //! @copydoc ::boost::intrusive::sgtree::find(const KeyType&,KeyValueCompare)
739 template<class KeyType, class KeyValueCompare>
740 iterator find(const KeyType& key, KeyValueCompare comp);
741
742 //! @copydoc ::boost::intrusive::sgtree::find(const_reference)const
743 const_iterator find(const_reference value) const;
744
745 //! @copydoc ::boost::intrusive::sgtree::find(const KeyType&,KeyValueCompare)const
746 template<class KeyType, class KeyValueCompare>
747 const_iterator find(const KeyType& key, KeyValueCompare comp) const;
748
749 //! @copydoc ::boost::intrusive::sgtree::equal_range(const_reference)
750 std::pair<iterator,iterator> equal_range(const_reference value);
751
752 //! @copydoc ::boost::intrusive::sgtree::equal_range(const KeyType&,KeyValueCompare)
753 template<class KeyType, class KeyValueCompare>
754 std::pair<iterator,iterator> equal_range(const KeyType& key, KeyValueCompare comp);
755
756 //! @copydoc ::boost::intrusive::sgtree::equal_range(const_reference)const
757 std::pair<const_iterator, const_iterator>
758 equal_range(const_reference value) const;
759
760 //! @copydoc ::boost::intrusive::sgtree::equal_range(const KeyType&,KeyValueCompare)const
761 template<class KeyType, class KeyValueCompare>
762 std::pair<const_iterator, const_iterator>
763 equal_range(const KeyType& key, KeyValueCompare comp) const;
764
765 //! @copydoc ::boost::intrusive::sgtree::bounded_range(const_reference,const_reference,bool,bool)
766 std::pair<iterator,iterator> bounded_range
767 (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed);
768
769 //! @copydoc ::boost::intrusive::sgtree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)
770 template<class KeyType, class KeyValueCompare>
771 std::pair<iterator,iterator> bounded_range
772 (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed);
773
774 //! @copydoc ::boost::intrusive::sgtree::bounded_range(const_reference,const_reference,bool,bool)const
775 std::pair<const_iterator, const_iterator>
776 bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const;
777
778 //! @copydoc ::boost::intrusive::sgtree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)const
779 template<class KeyType, class KeyValueCompare>
780 std::pair<const_iterator, const_iterator> bounded_range
781 (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const;
782
783 //! @copydoc ::boost::intrusive::sgtree::s_iterator_to(reference)
784 static iterator s_iterator_to(reference value);
785
786 //! @copydoc ::boost::intrusive::sgtree::s_iterator_to(const_reference)
787 static const_iterator s_iterator_to(const_reference value);
788
789 //! @copydoc ::boost::intrusive::sgtree::iterator_to(reference)
790 iterator iterator_to(reference value);
791
792 //! @copydoc ::boost::intrusive::sgtree::iterator_to(const_reference)const
793 const_iterator iterator_to(const_reference value) const;
794
795 //! @copydoc ::boost::intrusive::sgtree::init_node(reference)
796 static void init_node(reference value);
797
798 //! @copydoc ::boost::intrusive::sgtree::unlink_leftmost_without_rebalance
799 pointer unlink_leftmost_without_rebalance();
800
801 //! @copydoc ::boost::intrusive::sgtree::replace_node
802 void replace_node(iterator replace_this, reference with_this);
803
804 //! @copydoc ::boost::intrusive::sgtree::remove_node
805 void remove_node(reference value);
806
807 //! @copydoc ::boost::intrusive::sgtree::rebalance
808 void rebalance();
809
810 //! @copydoc ::boost::intrusive::sgtree::rebalance_subtree
811 iterator rebalance_subtree(iterator root);
812
813 //! @copydoc ::boost::intrusive::sgtree::balance_factor()
814 float balance_factor() const;
815
816 //! @copydoc ::boost::intrusive::sgtree::balance_factor(float)
817 void balance_factor(float new_alpha);
818
819 #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
820 };
821
822 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
823
824 template<class T, class ...Options>
825 bool operator!= (const sg_multiset_impl<T, Options...> &x, const sg_multiset_impl<T, Options...> &y);
826
827 template<class T, class ...Options>
828 bool operator>(const sg_multiset_impl<T, Options...> &x, const sg_multiset_impl<T, Options...> &y);
829
830 template<class T, class ...Options>
831 bool operator<=(const sg_multiset_impl<T, Options...> &x, const sg_multiset_impl<T, Options...> &y);
832
833 template<class T, class ...Options>
834 bool operator>=(const sg_multiset_impl<T, Options...> &x, const sg_multiset_impl<T, Options...> &y);
835
836 template<class T, class ...Options>
837 void swap(sg_multiset_impl<T, Options...> &x, sg_multiset_impl<T, Options...> &y);
838
839 #endif //#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
840
841 //! Helper metafunction to define a \c sg_multiset that yields to the same type when the
842 //! same options (either explicitly or implicitly) are used.
843 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
844 template<class T, class ...Options>
845 #else
846 template<class T, class O1 = void, class O2 = void
847 , class O3 = void, class O4 = void>
848 #endif
849 struct make_sg_multiset
850 {
851 /// @cond
852 typedef typename pack_options
853 < sgtree_defaults,
854 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
855 O1, O2, O3, O4
856 #else
857 Options...
858 #endif
859 >::type packed_options;
860
861 typedef typename detail::get_value_traits
862 <T, typename packed_options::proto_value_traits>::type value_traits;
863
864 typedef sg_multiset_impl
865 < value_traits
866 , typename packed_options::compare
867 , typename packed_options::size_type
868 , packed_options::floating_point
869 > implementation_defined;
870 /// @endcond
871 typedef implementation_defined type;
872 };
873
874 #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
875
876 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
877 template<class T, class O1, class O2, class O3, class O4>
878 #else
879 template<class T, class ...Options>
880 #endif
881 class sg_multiset
882 : public make_sg_multiset<T,
883 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
884 O1, O2, O3, O4
885 #else
886 Options...
887 #endif
888 >::type
889 {
890 typedef typename make_sg_multiset<T,
891 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
892 O1, O2, O3, O4
893 #else
894 Options...
895 #endif
896 >::type Base;
897
898 BOOST_MOVABLE_BUT_NOT_COPYABLE(sg_multiset)
899
900 public:
901 typedef typename Base::value_compare value_compare;
902 typedef typename Base::value_traits value_traits;
903 typedef typename Base::iterator iterator;
904 typedef typename Base::const_iterator const_iterator;
905
906 //Assert if passed value traits are compatible with the type
907 BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
908
909 sg_multiset( const value_compare &cmp = value_compare()
910 , const value_traits &v_traits = value_traits())
911 : Base(cmp, v_traits)
912 {}
913
914 template<class Iterator>
915 sg_multiset( Iterator b, Iterator e
916 , const value_compare &cmp = value_compare()
917 , const value_traits &v_traits = value_traits())
918 : Base(b, e, cmp, v_traits)
919 {}
920
921 sg_multiset(BOOST_RV_REF(sg_multiset) x)
922 : Base(::boost::move(static_cast<Base&>(x)))
923 {}
924
925 sg_multiset& operator=(BOOST_RV_REF(sg_multiset) x)
926 { return static_cast<sg_multiset &>(this->Base::operator=(::boost::move(static_cast<Base&>(x)))); }
927
928 static sg_multiset &container_from_end_iterator(iterator end_iterator)
929 { return static_cast<sg_multiset &>(Base::container_from_end_iterator(end_iterator)); }
930
931 static const sg_multiset &container_from_end_iterator(const_iterator end_iterator)
932 { return static_cast<const sg_multiset &>(Base::container_from_end_iterator(end_iterator)); }
933
934 static sg_multiset &container_from_iterator(iterator it)
935 { return static_cast<sg_multiset &>(Base::container_from_iterator(it)); }
936
937 static const sg_multiset &container_from_iterator(const_iterator it)
938 { return static_cast<const sg_multiset &>(Base::container_from_iterator(it)); }
939 };
940
941 #endif
942
943 } //namespace intrusive
944 } //namespace boost
945
946 #include <boost/intrusive/detail/config_end.hpp>
947
948 #endif //BOOST_INTRUSIVE_SG_SET_HPP