$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: igaztanaga_at_[hidden]
Date: 2008-06-19 10:29:52
Author: igaztanaga
Date: 2008-06-19 10:29:52 EDT (Thu, 19 Jun 2008)
New Revision: 46511
URL: http://svn.boost.org/trac/boost/changeset/46511
Log:
#2019: Intrusive lists seem to return invalid references with member hooks in 64 bit mode on calling front/back
Text files modified: 
   trunk/boost/intrusive/detail/parent_from_member.hpp |    14 +++++++++++---                          
   1 files changed, 11 insertions(+), 3 deletions(-)
Modified: trunk/boost/intrusive/detail/parent_from_member.hpp
==============================================================================
--- trunk/boost/intrusive/detail/parent_from_member.hpp	(original)
+++ trunk/boost/intrusive/detail/parent_from_member.hpp	2008-06-19 10:29:52 EDT (Thu, 19 Jun 2008)
@@ -16,6 +16,11 @@
 #include <boost/static_assert.hpp>
 #include <cstddef>
 
+#if defined(BOOST_MSVC) || (defined (BOOST_WINDOWS) && defined(BOOST_INTEL))
+#define BOOST_INTRUSIVE_OFFSET_FROM_PTR2MEMBER_MSVC_COMPLIANT
+#include <boost/cstdint.hpp> 
+#endif
+
 namespace boost {
 namespace intrusive {
 namespace detail {
@@ -23,11 +28,10 @@
 template<class Parent, class Member>
 inline std::size_t offset_from_pointer_to_member(const Member Parent::* ptr_to_member)
 {
-   //BOOST_STATIC_ASSERT(( sizeof(std::ptrdiff_t) == sizeof(ptr_to_member) ));
    //The implementation of a pointer to member is compiler dependent.
-   #if defined(BOOST_MSVC) || (defined (BOOST_WINDOWS) && defined(BOOST_INTEL))
+   #if defined(BOOST_INTRUSIVE_OFFSET_FROM_PTR2MEMBER_MSVC_COMPLIANT)
    //This works with gcc, msvc, ac++, ibmcpp
-   return *(const std::ptrdiff_t*)(void*)&ptr_to_member;
+   return *(const boost::int32_t*)(void*)&ptr_to_member;
    #elif defined(__GNUC__) || defined(__HP_aCC) || defined(BOOST_INTEL) || defined (__IBMCPP__) || defined (__DECCXX)
    const Parent * const parent = 0;
    const char *const member = reinterpret_cast<const char*>(&(parent->*ptr_to_member));
@@ -56,6 +60,10 @@
 }  //namespace intrusive {
 }  //namespace boost {
 
+#ifdef BOOST_INTRUSIVE_OFFSET_FROM_PTR2MEMBER_MSVC_COMPLIANT
+#undef BOOST_INTRUSIVE_OFFSET_FROM_PTR2MEMBER_MSVC_COMPLIANT
+#endif
+
 #include <boost/intrusive/detail/config_end.hpp>
 
 #endif   //#ifndef BOOST_INTRUSIVE_PARENT_FROM_MEMBER_HPP