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