summaryrefslogtreecommitdiff
path: root/boost/intrusive/derivation_value_traits.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/intrusive/derivation_value_traits.hpp')
-rw-r--r--boost/intrusive/derivation_value_traits.hpp37
1 files changed, 22 insertions, 15 deletions
diff --git a/boost/intrusive/derivation_value_traits.hpp b/boost/intrusive/derivation_value_traits.hpp
index 0aae01b619..87bc489cf5 100644
--- a/boost/intrusive/derivation_value_traits.hpp
+++ b/boost/intrusive/derivation_value_traits.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2006-2012
+// (C) Copyright Ion Gaztanaga 2006-2013
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -13,10 +13,14 @@
#ifndef BOOST_INTRUSIVE_DERIVATION_VALUE_TRAITS_HPP
#define BOOST_INTRUSIVE_DERIVATION_VALUE_TRAITS_HPP
+#if defined(_MSC_VER)
+# pragma once
+#endif
+
+#include <boost/intrusive/detail/config_begin.hpp>
+#include <boost/intrusive/intrusive_fwd.hpp>
#include <boost/intrusive/link_mode.hpp>
-#include <boost/pointer_cast.hpp>
-#include <boost/pointer_to_other.hpp>
-#include <iterator>
+#include <boost/intrusive/pointer_traits.hpp>
namespace boost {
namespace intrusive {
@@ -24,7 +28,12 @@ namespace intrusive {
//!This value traits template is used to create value traits
//!from user defined node traits where value_traits::value_type will
//!derive from node_traits::node
-template<class T, class NodeTraits, link_mode_type LinkMode = safe_link>
+
+template<class T, class NodeTraits, link_mode_type LinkMode
+ #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
+ = safe_link
+ #endif
+>
struct derivation_value_traits
{
public:
@@ -33,8 +42,10 @@ struct derivation_value_traits
typedef typename node_traits::node node;
typedef typename node_traits::node_ptr node_ptr;
typedef typename node_traits::const_node_ptr const_node_ptr;
- typedef typename boost::pointer_to_other<node_ptr, T>::type pointer;
- typedef typename boost::pointer_to_other<node_ptr, const T>::type const_pointer;
+ typedef typename pointer_traits<node_ptr>::
+ template rebind_pointer<value_type>::type pointer;
+ typedef typename pointer_traits<node_ptr>::
+ template rebind_pointer<const value_type>::type const_pointer;
typedef typename boost::intrusive::
pointer_traits<pointer>::reference reference;
typedef typename boost::intrusive::
@@ -49,22 +60,18 @@ struct derivation_value_traits
static pointer to_value_ptr(const node_ptr &n)
{
-// This still fails in gcc < 4.4 so forget about it
-// using ::boost::static_pointer_cast;
-// return static_pointer_cast<value_type>(n));
- return pointer(&static_cast<value_type&>(*n));
+ return pointer_traits<pointer>::pointer_to(static_cast<reference>(*n));
}
static const_pointer to_value_ptr(const const_node_ptr &n)
{
-// This still fails in gcc < 4.4 so forget about it
-// using ::boost::static_pointer_cast;
-// return static_pointer_cast<const value_type>(n));
- return const_pointer(&static_cast<const value_type&>(*n));
+ return pointer_traits<pointer>::pointer_to(static_cast<const_reference>(*n));
}
};
} //namespace intrusive
} //namespace boost
+#include <boost/intrusive/detail/config_end.hpp>
+
#endif //BOOST_INTRUSIVE_DERIVATION_VALUE_TRAITS_HPP