blob: 34443c3abde85575ca580233d54c80cd7da9176a [file] [log] [blame]
Jeff Thompsona28eed82013-08-22 16:21:10 -07001// Copyright Peter Dimov and David Abrahams 2002.
2// Distributed under the Boost Software License, Version 1.0. (See
3// accompanying file LICENSE_1_0.txt or copy at
4// http://www.boost.org/LICENSE_1_0.txt)
Jeff Thompson2491bd62013-10-15 17:10:24 -07005#ifndef GET_POINTER_NDNBOOST_DWA20021219_HPP
6#define GET_POINTER_NDNBOOST_DWA20021219_HPP
Jeff Thompsona28eed82013-08-22 16:21:10 -07007
8#include <ndnboost/config.hpp>
9
10// In order to avoid circular dependencies with Boost.TR1
11// we make sure that our include of <memory> doesn't try to
12// pull in the TR1 headers: that's why we use this header
13// rather than including <memory> directly:
14#include <ndnboost/config/no_tr1/memory.hpp> // std::auto_ptr
15
16namespace ndnboost {
17
18// get_pointer(p) extracts a ->* capable pointer from p
19
20template<class T> T * get_pointer(T * p)
21{
22 return p;
23}
24
25// get_pointer(shared_ptr<T> const & p) has been moved to shared_ptr.hpp
26
27template<class T> T * get_pointer(std::auto_ptr<T> const& p)
28{
29 return p.get();
30}
31
Jeff Thompson3d613fd2013-10-15 15:39:04 -070032#if !defined( NDNBOOST_NO_CXX11_SMART_PTR )
Jeff Thompsona28eed82013-08-22 16:21:10 -070033
34template<class T> T * get_pointer( std::unique_ptr<T> const& p )
35{
36 return p.get();
37}
38
39template<class T> T * get_pointer( std::shared_ptr<T> const& p )
40{
41 return p.get();
42}
43
44#endif
45
46} // namespace ndnboost
47
Jeff Thompson2491bd62013-10-15 17:10:24 -070048#endif // GET_POINTER_NDNBOOST_DWA20021219_HPP