is_stateful_value_traits.hpp 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. #include <boost/intrusive/detail/config_begin.hpp>
  15. #if defined(_MSC_VER) && (_MSC_VER <= 1310)
  16. #include <boost/intrusive/detail/mpl.hpp>
  17. namespace boost {
  18. namespace intrusive {
  19. namespace detail {
  20. template<class ValueTraits>
  21. struct is_stateful_value_traits
  22. {
  23. static const bool value = !detail::is_empty_class<ValueTraits>::value;
  24. };
  25. }}}
  26. #else
  27. #include <boost/intrusive/detail/function_detector.hpp>
  28. BOOST_INTRUSIVE_CREATE_FUNCTION_DETECTOR(to_node_ptr, boost_intrusive)
  29. BOOST_INTRUSIVE_CREATE_FUNCTION_DETECTOR(to_value_ptr, boost_intrusive)
  30. namespace boost {
  31. namespace intrusive {
  32. namespace detail {
  33. template<class ValueTraits>
  34. struct is_stateful_value_traits
  35. {
  36. typedef typename ValueTraits::node_ptr node_ptr;
  37. typedef typename ValueTraits::pointer pointer;
  38. typedef typename ValueTraits::value_type value_type;
  39. typedef typename ValueTraits::const_node_ptr const_node_ptr;
  40. typedef typename ValueTraits::const_pointer const_pointer;
  41. typedef ValueTraits value_traits;
  42. static const bool value =
  43. (boost::intrusive::function_detector::NonStaticFunction ==
  44. (BOOST_INTRUSIVE_DETECT_FUNCTION(ValueTraits, boost_intrusive, node_ptr, to_node_ptr, (value_type&) )))
  45. ||
  46. (boost::intrusive::function_detector::NonStaticFunction ==
  47. (BOOST_INTRUSIVE_DETECT_FUNCTION(ValueTraits, boost_intrusive, pointer, to_value_ptr, (node_ptr) )))
  48. ||
  49. (boost::intrusive::function_detector::NonStaticFunction ==
  50. (BOOST_INTRUSIVE_DETECT_FUNCTION(ValueTraits, boost_intrusive, const_node_ptr, to_node_ptr, (const value_type&) )))
  51. ||
  52. (boost::intrusive::function_detector::NonStaticFunction ==
  53. (BOOST_INTRUSIVE_DETECT_FUNCTION(ValueTraits, boost_intrusive, const_pointer, to_value_ptr, (const_node_ptr) )))
  54. ;
  55. };
  56. }}}
  57. #endif
  58. #include <boost/intrusive/detail/config_end.hpp>
  59. #endif //@ifndef BOOST_INTRUSIVE_DETAIL_IS_STATEFUL_VALUE_TRAITS_HPP