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