link_mode.hpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. #ifndef BOOST_INTRUSIVE_LINK_MODE_HPP
  13. #define BOOST_INTRUSIVE_LINK_MODE_HPP
  14. #if defined(BOOST_HAS_PRAGMA_ONCE)
  15. # pragma once
  16. #endif
  17. namespace boost {
  18. namespace intrusive {
  19. //!This enumeration defines the type of value_traits that can be defined
  20. //!for Boost.Intrusive containers
  21. enum link_mode_type{
  22. //!If this linking policy is specified in a value_traits class
  23. //!as the link_mode, containers
  24. //!configured with such value_traits won't set the hooks
  25. //!of the erased values to a default state. Containers also won't
  26. //!check that the hooks of the new values are default initialized.
  27. normal_link,
  28. //!If this linking policy is specified in a value_traits class
  29. //!as the link_mode, containers
  30. //!configured with such value_traits will set the hooks
  31. //!of the erased values to a default state. Containers also will
  32. //!check that the hooks of the new values are default initialized.
  33. safe_link,
  34. //!Same as "safe_link" but the user type is an auto-unlink
  35. //!type, so the containers with constant-time size features won't be
  36. //!compatible with value_traits configured with this policy.
  37. //!Containers also know that the a value can be silently erased from
  38. //!the container without using any function provided by the containers.
  39. auto_unlink
  40. };
  41. #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  42. template <link_mode_type link_mode>
  43. struct is_safe_autounlink
  44. {
  45. static const bool value =
  46. (int)link_mode == (int)auto_unlink ||
  47. (int)link_mode == (int)safe_link;
  48. };
  49. #endif //BOOST_INTRUSIVE_DOXYGEN_INVOKED
  50. } //namespace intrusive
  51. } //namespace boost
  52. #endif //BOOST_INTRUSIVE_LINK_MODE_HPP