Chris@16: ///////////////////////////////////////////////////////////////////////////// Chris@16: // Chris@16: // (C) Copyright Ion Gaztanaga 2010-2013 Chris@16: // Chris@16: // Distributed under the Boost Software License, Version 1.0. Chris@16: // (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: // Chris@16: // See http://www.boost.org/libs/intrusive for documentation. Chris@16: // Chris@16: ///////////////////////////////////////////////////////////////////////////// Chris@101: #ifndef BOOST_INTRUSIVE_PARENT_FROM_MEMBER_HPP Chris@101: #define BOOST_INTRUSIVE_PARENT_FROM_MEMBER_HPP Chris@16: Chris@16: #include Chris@101: #include Chris@101: Chris@16: #include Chris@16: Chris@101: #if defined(BOOST_HAS_PRAGMA_ONCE) Chris@101: # pragma once Chris@101: #endif Chris@101: Chris@16: namespace boost { Chris@16: namespace intrusive { Chris@16: Chris@16: //! Given a pointer to a member and its corresponding pointer to data member, Chris@16: //! this function returns the pointer of the parent containing that member. Chris@16: //! Note: this function does not work with pointer to members that rely on Chris@16: //! virtual inheritance. Chris@16: template Chris@16: inline Parent *get_parent_from_member(Member *member, const Member Parent::* ptr_to_member) Chris@16: { return ::boost::intrusive::detail::parent_from_member(member, ptr_to_member); } Chris@16: Chris@16: //! Given a const pointer to a member and its corresponding const pointer to data member, Chris@16: //! this function returns the const pointer of the parent containing that member. Chris@16: //! Note: this function does not work with pointer to members that rely on Chris@16: //! virtual inheritance. Chris@16: template Chris@16: inline const Parent *get_parent_from_member(const Member *member, const Member Parent::* ptr_to_member) Chris@16: { return ::boost::intrusive::detail::parent_from_member(member, ptr_to_member); } Chris@16: Chris@16: } //namespace intrusive { Chris@16: } //namespace boost { Chris@16: Chris@16: #include Chris@16: Chris@101: #endif //#ifndef BOOST_INTRUSIVE_PARENT_FROM_MEMBER_HPP