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