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@16
|
12 #ifndef BOOST_INTRUSIVE_GET_PARENT_FROM_MEMBER_HPP
|
Chris@16
|
13 #define BOOST_INTRUSIVE_GET_PARENT_FROM_MEMBER_HPP
|
Chris@16
|
14
|
Chris@16
|
15 #include <boost/intrusive/detail/config_begin.hpp>
|
Chris@16
|
16 #include <boost/intrusive/detail/parent_from_member.hpp>
|
Chris@16
|
17
|
Chris@16
|
18 namespace boost {
|
Chris@16
|
19 namespace intrusive {
|
Chris@16
|
20
|
Chris@16
|
21 //! Given a pointer to a member and its corresponding pointer to data member,
|
Chris@16
|
22 //! this function returns the pointer of the parent containing that member.
|
Chris@16
|
23 //! Note: this function does not work with pointer to members that rely on
|
Chris@16
|
24 //! virtual inheritance.
|
Chris@16
|
25 template<class Parent, class Member>
|
Chris@16
|
26 inline Parent *get_parent_from_member(Member *member, const Member Parent::* ptr_to_member)
|
Chris@16
|
27 { return ::boost::intrusive::detail::parent_from_member(member, ptr_to_member); }
|
Chris@16
|
28
|
Chris@16
|
29 //! Given a const pointer to a member and its corresponding const pointer to data member,
|
Chris@16
|
30 //! this function returns the const pointer of the parent containing that member.
|
Chris@16
|
31 //! Note: this function does not work with pointer to members that rely on
|
Chris@16
|
32 //! virtual inheritance.
|
Chris@16
|
33 template<class Parent, class Member>
|
Chris@16
|
34 inline const Parent *get_parent_from_member(const Member *member, const Member Parent::* ptr_to_member)
|
Chris@16
|
35 { return ::boost::intrusive::detail::parent_from_member(member, ptr_to_member); }
|
Chris@16
|
36
|
Chris@16
|
37 } //namespace intrusive {
|
Chris@16
|
38 } //namespace boost {
|
Chris@16
|
39
|
Chris@16
|
40 #include <boost/intrusive/detail/config_end.hpp>
|
Chris@16
|
41
|
Chris@16
|
42 #endif //#ifndef BOOST_INTRUSIVE_GET_PARENT_FROM_MEMBER_HPP
|