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