/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga  2009-2009.
//
// Distributed under the Boost Software License, Version 1.0.
//    (See accompanying file LICENSE_1_0.txt or copy at
//          http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/intrusive for documentation.
//
/////////////////////////////////////////////////////////////////////////////

#ifndef CPPCMS_BOOST_INTRUSIVE_DETAIL_IS_STATEFUL_VALUE_TRAITS_HPP
#define CPPCMS_BOOST_INTRUSIVE_DETAIL_IS_STATEFUL_VALUE_TRAITS_HPP

#include <cppcms_boost/intrusive/detail/config_begin.hpp>

#if defined(_MSC_VER) && (_MSC_VER <= 1310)

#include <cppcms_boost/intrusive/detail/mpl.hpp>

namespace cppcms_boost {
namespace intrusive {
namespace detail {

template<class ValueTraits>
struct is_stateful_value_traits
{
   static const bool value = !detail::is_empty_class<ValueTraits>::value;
};

}}}

#else

#include <cppcms_boost/intrusive/detail/function_detector.hpp>

CPPCMS_BOOST_INTRUSIVE_CREATE_FUNCTION_DETECTOR(to_node_ptr, cppcms_boost_intrusive)
CPPCMS_BOOST_INTRUSIVE_CREATE_FUNCTION_DETECTOR(to_value_ptr, cppcms_boost_intrusive)

namespace cppcms_boost {
namespace intrusive {
namespace detail {

template<class ValueTraits>
struct is_stateful_value_traits
{
   typedef typename ValueTraits::node_ptr       node_ptr;
   typedef typename ValueTraits::pointer        pointer;
   typedef typename ValueTraits::value_type     value_type;
   typedef typename ValueTraits::const_node_ptr const_node_ptr;
   typedef typename ValueTraits::const_pointer  const_pointer;

   typedef ValueTraits value_traits;

   static const bool value =
      (cppcms_boost::intrusive::function_detector::NonStaticFunction ==
         (CPPCMS_BOOST_INTRUSIVE_DETECT_FUNCTION(ValueTraits, cppcms_boost_intrusive, node_ptr, to_node_ptr, (value_type&) )))
      ||
      (cppcms_boost::intrusive::function_detector::NonStaticFunction ==
         (CPPCMS_BOOST_INTRUSIVE_DETECT_FUNCTION(ValueTraits, cppcms_boost_intrusive, pointer, to_value_ptr, (node_ptr) )))
      ||
      (cppcms_boost::intrusive::function_detector::NonStaticFunction ==
         (CPPCMS_BOOST_INTRUSIVE_DETECT_FUNCTION(ValueTraits, cppcms_boost_intrusive, const_node_ptr, to_node_ptr, (const value_type&) )))
      ||
      (cppcms_boost::intrusive::function_detector::NonStaticFunction ==
         (CPPCMS_BOOST_INTRUSIVE_DETECT_FUNCTION(ValueTraits, cppcms_boost_intrusive, const_pointer, to_value_ptr, (const_node_ptr) )))
      ;
};

}}}

#endif

#include <cppcms_boost/intrusive/detail/config_end.hpp>

#endif   //@ifndef BOOST_INTRUSIVE_DETAIL_IS_STATEFUL_VALUE_TRAITS_HPP
