• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /////////////////////////////////////////////////////////////////////////////
2 //
3 // (C) Copyright Ion Gaztanaga  2006-2013
4 //
5 // Distributed under the Boost Software License, Version 1.0.
6 //    (See accompanying file LICENSE_1_0.txt or copy at
7 //          http://www.boost.org/LICENSE_1_0.txt)
8 //
9 // See http://www.boost.org/libs/intrusive for documentation.
10 //
11 /////////////////////////////////////////////////////////////////////////////
12 
13 #ifndef BOOST_INTRUSIVE_LINK_MODE_HPP
14 #define BOOST_INTRUSIVE_LINK_MODE_HPP
15 
16 #if defined(BOOST_HAS_PRAGMA_ONCE)
17 #  pragma once
18 #endif
19 
20 namespace boost {
21 namespace intrusive {
22 
23 //!This enumeration defines the type of value_traits that can be defined
24 //!for Boost.Intrusive containers
25 enum link_mode_type{
26    //!If this linking policy is specified in a value_traits class
27    //!as the link_mode, containers
28    //!configured with such value_traits won't set the hooks
29    //!of the erased values to a default state. Containers also won't
30    //!check that the hooks of the new values are default initialized.
31    normal_link,
32 
33    //!If this linking policy is specified in a value_traits class
34    //!as the link_mode, containers
35    //!configured with such value_traits will set the hooks
36    //!of the erased values to a default state. Containers also will
37    //!check that the hooks of the new values are default initialized.
38    safe_link,
39 
40    //!Same as "safe_link" but the user type is an auto-unlink
41    //!type, so the containers with constant-time size features won't be
42    //!compatible with value_traits configured with this policy.
43    //!Containers also know that the a value can be silently erased from
44    //!the container without using any function provided by the containers.
45    auto_unlink
46 };
47 
48 #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
49 
50 template <link_mode_type link_mode>
51 struct is_safe_autounlink
52 {
53    static const bool value =
54       (int)link_mode == (int)auto_unlink   ||
55       (int)link_mode == (int)safe_link;
56 };
57 
58 #endif   //BOOST_INTRUSIVE_DOXYGEN_INVOKED
59 
60 } //namespace intrusive
61 } //namespace boost
62 
63 #endif //BOOST_INTRUSIVE_LINK_MODE_HPP
64