1/////////////////////////////////////////////////////////////////////////////
2//
3// (C) Copyright Ion Gaztanaga 2010-2013
4//
5// Distributed under the Boost Software License, Version 1.0.
6// (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
9// See http://www.boost.org/libs/intrusive for documentation.
10//
11/////////////////////////////////////////////////////////////////////////////
12#ifndef BOOST_INTRUSIVE_PARENT_FROM_MEMBER_HPP
13#define BOOST_INTRUSIVE_PARENT_FROM_MEMBER_HPP
14
15#include <boost/intrusive/detail/config_begin.hpp>
16#include <boost/intrusive/intrusive_fwd.hpp>
17
18#include <boost/intrusive/detail/parent_from_member.hpp>
19
20#if defined(BOOST_HAS_PRAGMA_ONCE)
21# pragma once
22#endif
23
24namespace boost {
25namespace intrusive {
26
27//! Given a pointer to a member and its corresponding pointer to data member,
28//! this function returns the pointer of the parent containing that member.
29//! Note: this function does not work with pointer to members that rely on
30//! virtual inheritance.
31template<class Parent, class Member>
32inline Parent *get_parent_from_member(Member *member, const Member Parent::* ptr_to_member)
33{ return ::boost::intrusive::detail::parent_from_member(member, ptr_to_member); }
34
35//! Given a const pointer to a member and its corresponding const pointer to data member,
36//! this function returns the const pointer of the parent containing that member.
37//! Note: this function does not work with pointer to members that rely on
38//! virtual inheritance.
39template<class Parent, class Member>
40inline const Parent *get_parent_from_member(const Member *member, const Member Parent::* ptr_to_member)
41{ return ::boost::intrusive::detail::parent_from_member(member, ptr_to_member); }
42
43} //namespace intrusive {
44} //namespace boost {
45
46#include <boost/intrusive/detail/config_end.hpp>
47
48#endif //#ifndef BOOST_INTRUSIVE_PARENT_FROM_MEMBER_HPP
49

source code of boost/boost/intrusive/parent_from_member.hpp