|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r78588 - trunk/boost/intrusive/detail
From: igaztanaga_at_[hidden]
Date: 2012-05-24 11:50:46
Author: igaztanaga
Date: 2012-05-24 11:50:45 EDT (Thu, 24 May 2012)
New Revision: 78588
URL: http://svn.boost.org/trac/boost/changeset/78588
Log:
More correct casting
Text files modified:
trunk/boost/intrusive/detail/parent_from_member.hpp | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 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 2012-05-24 11:50:45 EDT (Thu, 24 May 2012)
@@ -47,13 +47,25 @@
template<class Parent, class Member>
inline Parent *parent_from_member(Member *member, const Member Parent::* ptr_to_member)
{
- return (Parent*)((char*)member - offset_from_pointer_to_member(ptr_to_member));
+ return static_cast<Parent*>
+ (
+ static_cast<void*>
+ (
+ static_cast<char*>(static_cast<void*>(member)) - offset_from_pointer_to_member(ptr_to_member)
+ )
+ );
}
template<class Parent, class Member>
inline const Parent *parent_from_member(const Member *member, const Member Parent::* ptr_to_member)
{
- return (const Parent*)((const char*)member - offset_from_pointer_to_member(ptr_to_member));
+ return static_cast<const Parent*>
+ (
+ static_cast<const void*>
+ (
+ static_cast<const char*>(static_cast<const void*>(member)) - offset_from_pointer_to_member(ptr_to_member)
+ )
+ );
}
} //namespace detail {
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk