comparison DEPENDENCIES/generic/include/boost/intrusive/any_hook.hpp @ 101:c530137014c0

Update Boost headers (1.58.0)
author Chris Cannam
date Mon, 07 Sep 2015 11:12:49 +0100
parents 2665513ce2d3
children
comparison
equal deleted inserted replaced
100:793467b5e61c 101:c530137014c0
13 #ifndef BOOST_INTRUSIVE_ANY_HOOK_HPP 13 #ifndef BOOST_INTRUSIVE_ANY_HOOK_HPP
14 #define BOOST_INTRUSIVE_ANY_HOOK_HPP 14 #define BOOST_INTRUSIVE_ANY_HOOK_HPP
15 15
16 #include <boost/intrusive/detail/config_begin.hpp> 16 #include <boost/intrusive/detail/config_begin.hpp>
17 #include <boost/intrusive/intrusive_fwd.hpp> 17 #include <boost/intrusive/intrusive_fwd.hpp>
18 #include <boost/intrusive/detail/utilities.hpp>
19 #include <boost/intrusive/detail/any_node_and_algorithms.hpp> 18 #include <boost/intrusive/detail/any_node_and_algorithms.hpp>
20 #include <boost/intrusive/options.hpp> 19 #include <boost/intrusive/options.hpp>
21 #include <boost/intrusive/detail/generic_hook.hpp> 20 #include <boost/intrusive/detail/generic_hook.hpp>
22 #include <boost/intrusive/pointer_traits.hpp> 21 #include <boost/intrusive/detail/mpl.hpp>
22 #include <boost/intrusive/pointer_rebind.hpp>
23
24 #if defined(BOOST_HAS_PRAGMA_ONCE)
25 # pragma once
26 #endif
23 27
24 namespace boost { 28 namespace boost {
25 namespace intrusive { 29 namespace intrusive {
26
27 /// @cond
28 template<class VoidPointer>
29 struct get_any_node_algo
30 {
31 typedef any_algorithms<VoidPointer> type;
32 };
33 /// @endcond
34 30
35 //! Helper metafunction to define a \c \c any_base_hook that yields to the same 31 //! Helper metafunction to define a \c \c any_base_hook that yields to the same
36 //! type when the same options (either explicitly or implicitly) are used. 32 //! type when the same options (either explicitly or implicitly) are used.
37 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) 33 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
38 template<class ...Options> 34 template<class ...Options>
50 Options... 46 Options...
51 #endif 47 #endif
52 >::type packed_options; 48 >::type packed_options;
53 49
54 typedef generic_hook 50 typedef generic_hook
55 < get_any_node_algo<typename packed_options::void_pointer> 51 < any_algorithms<typename packed_options::void_pointer>
56 , typename packed_options::tag 52 , typename packed_options::tag
57 , packed_options::link_mode 53 , packed_options::link_mode
58 , AnyBaseHookId 54 , AnyBaseHookId
59 > implementation_defined; 55 > implementation_defined;
60 /// @endcond 56 /// @endcond
73 //! unique tag. 69 //! unique tag.
74 //! 70 //!
75 //! \c link_mode<> will specify the linking mode of the hook (\c normal_link, \c safe_link). 71 //! \c link_mode<> will specify the linking mode of the hook (\c normal_link, \c safe_link).
76 //! 72 //!
77 //! \c void_pointer<> is the pointer type that will be used internally in the hook 73 //! \c void_pointer<> is the pointer type that will be used internally in the hook
78 //! and the the container configured to use this hook. 74 //! and the container configured to use this hook.
79 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) 75 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
80 template<class ...Options> 76 template<class ...Options>
81 #else 77 #else
82 template<class O1, class O2, class O3> 78 template<class O1, class O2, class O3>
83 #endif 79 #endif
155 Options... 151 Options...
156 #endif 152 #endif
157 >::type packed_options; 153 >::type packed_options;
158 154
159 typedef generic_hook 155 typedef generic_hook
160 < get_any_node_algo<typename packed_options::void_pointer> 156 < any_algorithms<typename packed_options::void_pointer>
161 , member_tag 157 , member_tag
162 , packed_options::link_mode 158 , packed_options::link_mode
163 , NoBaseHookId 159 , NoBaseHookId
164 > implementation_defined; 160 > implementation_defined;
165 /// @endcond 161 /// @endcond
173 //! \c link_mode<>. 169 //! \c link_mode<>.
174 //! 170 //!
175 //! \c link_mode<> will specify the linking mode of the hook (\c normal_link or \c safe_link). 171 //! \c link_mode<> will specify the linking mode of the hook (\c normal_link or \c safe_link).
176 //! 172 //!
177 //! \c void_pointer<> is the pointer type that will be used internally in the hook 173 //! \c void_pointer<> is the pointer type that will be used internally in the hook
178 //! and the the container configured to use this hook. 174 //! and the container configured to use this hook.
179 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) 175 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
180 template<class ...Options> 176 template<class ...Options>
181 #else 177 #else
182 template<class O1, class O2, class O3> 178 template<class O1, class O2, class O3>
183 #endif 179 #endif
239 235
240 /// @cond 236 /// @cond
241 237
242 namespace detail{ 238 namespace detail{
243 239
244 template<class ValueTraits> 240 BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(old_proto_value_traits_base_hook, hooktags::is_base_hook)
245 struct any_to_get_base_pointer_type
246 {
247 typedef typename pointer_traits<typename ValueTraits::hooktags::node_traits::node_ptr>::template
248 rebind_pointer<void>::type type;
249 };
250
251 template<class ValueTraits>
252 struct any_to_get_member_pointer_type
253 {
254 typedef typename pointer_traits
255 <typename ValueTraits::node_ptr>::template rebind_pointer<void>::type type;
256 };
257 241
258 //!This option setter specifies that the container 242 //!This option setter specifies that the container
259 //!must use the specified base hook 243 //!must use the specified base hook
260 template<class BaseHook, template <class> class NodeTraits> 244 template<class BasicHook, template <class> class NodeTraits>
261 struct any_to_some_hook 245 struct any_to_some_hook
262 { 246 {
263 typedef typename BaseHook::template pack<empty>::proto_value_traits old_proto_value_traits; 247 typedef typename BasicHook::template pack<empty>::proto_value_traits old_proto_value_traits;
264 248
265 template<class Base> 249 template<class Base>
266 struct pack : public Base 250 struct pack : public Base
267 { 251 {
268 struct proto_value_traits : public old_proto_value_traits 252 struct proto_value_traits
269 { 253 {
254 //proto_value_traits::hooktags::is_base_hook is used by get_value_traits
255 //to detect base hooks, so mark it in case BasicHook has it.
256 struct hooktags
257 {
258 static const bool is_base_hook = old_proto_value_traits_base_hook_bool_is_true
259 <old_proto_value_traits>::value;
260 };
261
262 typedef old_proto_value_traits basic_hook_t;
270 static const bool is_any_hook = true; 263 static const bool is_any_hook = true;
271 typedef typename detail::eval_if_c 264
272 < detail::internal_base_hook_bool_is_true<old_proto_value_traits>::value 265 template<class VoidPtr>
273 , any_to_get_base_pointer_type<old_proto_value_traits> 266 struct node_traits_from_voidptr
274 , any_to_get_member_pointer_type<old_proto_value_traits> 267 { typedef NodeTraits<VoidPtr> type; };
275 >::type void_pointer;
276 typedef NodeTraits<void_pointer> node_traits;
277 }; 268 };
278 }; 269 };
279 }; 270 };
280 271
281 } //namespace detail{ 272 } //namespace detail{
282 273
283 /// @endcond 274 /// @endcond
284 275
285 //!This option setter specifies that 276 //!This option setter specifies that
286 //!any hook should behave as an slist hook 277 //!any hook should behave as an slist hook
287 template<class BaseHook> 278 template<class BasicHook>
288 struct any_to_slist_hook 279 struct any_to_slist_hook
289 /// @cond 280 /// @cond
290 : public detail::any_to_some_hook<BaseHook, any_slist_node_traits> 281 : public detail::any_to_some_hook<BasicHook, any_slist_node_traits>
291 /// @endcond 282 /// @endcond
292 {}; 283 {};
293 284
294 //!This option setter specifies that 285 //!This option setter specifies that
295 //!any hook should behave as an list hook 286 //!any hook should behave as an list hook
296 template<class BaseHook> 287 template<class BasicHook>
297 struct any_to_list_hook 288 struct any_to_list_hook
298 /// @cond 289 /// @cond
299 : public detail::any_to_some_hook<BaseHook, any_list_node_traits> 290 : public detail::any_to_some_hook<BasicHook, any_list_node_traits>
300 /// @endcond 291 /// @endcond
301 {}; 292 {};
302 293
303 //!This option setter specifies that 294 //!This option setter specifies that
304 //!any hook should behave as a set hook 295 //!any hook should behave as a set hook
305 template<class BaseHook> 296 template<class BasicHook>
306 struct any_to_set_hook 297 struct any_to_set_hook
307 /// @cond 298 /// @cond
308 : public detail::any_to_some_hook<BaseHook, any_rbtree_node_traits> 299 : public detail::any_to_some_hook<BasicHook, any_rbtree_node_traits>
309 /// @endcond 300 /// @endcond
310 {}; 301 {};
311 302
312 //!This option setter specifies that 303 //!This option setter specifies that
313 //!any hook should behave as an avl_set hook 304 //!any hook should behave as an avl_set hook
314 template<class BaseHook> 305 template<class BasicHook>
315 struct any_to_avl_set_hook 306 struct any_to_avl_set_hook
316 /// @cond 307 /// @cond
317 : public detail::any_to_some_hook<BaseHook, any_avltree_node_traits> 308 : public detail::any_to_some_hook<BasicHook, any_avltree_node_traits>
318 /// @endcond 309 /// @endcond
319 {}; 310 {};
320 311
321 //!This option setter specifies that any 312 //!This option setter specifies that any
322 //!hook should behave as a bs_set hook 313 //!hook should behave as a bs_set hook
323 template<class BaseHook> 314 template<class BasicHook>
324 struct any_to_bs_set_hook 315 struct any_to_bs_set_hook
325 /// @cond 316 /// @cond
326 : public detail::any_to_some_hook<BaseHook, any_tree_node_traits> 317 : public detail::any_to_some_hook<BasicHook, any_tree_node_traits>
327 /// @endcond 318 /// @endcond
328 {}; 319 {};
329 320
330 //!This option setter specifies that any hook 321 //!This option setter specifies that any hook
331 //!should behave as an unordered set hook 322 //!should behave as an unordered set hook
332 template<class BaseHook> 323 template<class BasicHook>
333 struct any_to_unordered_set_hook 324 struct any_to_unordered_set_hook
334 /// @cond 325 /// @cond
335 : public detail::any_to_some_hook<BaseHook, any_unordered_node_traits> 326 : public detail::any_to_some_hook<BasicHook, any_unordered_node_traits>
336 /// @endcond 327 /// @endcond
337 {}; 328 {};
338 329
339 330
340 } //namespace intrusive 331 } //namespace intrusive