is_stateful_value_traits.hpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // (C) Copyright Ion Gaztanaga 2009-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_DETAIL_IS_STATEFUL_VALUE_TRAITS_HPP
  13. #define BOOST_INTRUSIVE_DETAIL_IS_STATEFUL_VALUE_TRAITS_HPP
  14. #ifndef BOOST_CONFIG_HPP
  15. # include <boost/config.hpp>
  16. #endif
  17. #if defined(BOOST_HAS_PRAGMA_ONCE)
  18. # pragma once
  19. #endif
  20. #if defined(_MSC_VER) && (_MSC_VER <= 1310)
  21. #include <boost/intrusive/detail/mpl.hpp>
  22. namespace boost {
  23. namespace intrusive {
  24. namespace detail {
  25. template<class ValueTraits>
  26. struct is_stateful_value_traits
  27. {
  28. static const bool value = !detail::is_empty<ValueTraits>::value;
  29. };
  30. }}}
  31. #else
  32. #include <boost/intrusive/detail/function_detector.hpp>
  33. BOOST_INTRUSIVE_CREATE_FUNCTION_DETECTOR(to_node_ptr, boost_intrusive)
  34. BOOST_INTRUSIVE_CREATE_FUNCTION_DETECTOR(to_value_ptr, boost_intrusive)
  35. namespace boost {
  36. namespace intrusive {
  37. namespace detail {
  38. template<class ValueTraits>
  39. struct is_stateful_value_traits
  40. {
  41. typedef typename ValueTraits::node_ptr node_ptr;
  42. typedef typename ValueTraits::pointer pointer;
  43. typedef typename ValueTraits::value_type value_type;
  44. typedef typename ValueTraits::const_node_ptr const_node_ptr;
  45. typedef typename ValueTraits::const_pointer const_pointer;
  46. typedef ValueTraits value_traits;
  47. static const bool value =
  48. (boost::intrusive::function_detector::NonStaticFunction ==
  49. (BOOST_INTRUSIVE_DETECT_FUNCTION(ValueTraits, boost_intrusive, node_ptr, to_node_ptr, (value_type&) )))
  50. ||
  51. (boost::intrusive::function_detector::NonStaticFunction ==
  52. (BOOST_INTRUSIVE_DETECT_FUNCTION(ValueTraits, boost_intrusive, pointer, to_value_ptr, (node_ptr) )))
  53. ||
  54. (boost::intrusive::function_detector::NonStaticFunction ==
  55. (BOOST_INTRUSIVE_DETECT_FUNCTION(ValueTraits, boost_intrusive, const_node_ptr, to_node_ptr, (const value_type&) )))
  56. ||
  57. (boost::intrusive::function_detector::NonStaticFunction ==
  58. (BOOST_INTRUSIVE_DETECT_FUNCTION(ValueTraits, boost_intrusive, const_pointer, to_value_ptr, (const_node_ptr) )))
  59. ;
  60. };
  61. }}}
  62. #endif
  63. #endif //@ifndef BOOST_INTRUSIVE_DETAIL_IS_STATEFUL_VALUE_TRAITS_HPP