]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/interprocess/include/boost/interprocess/smart_ptr/unique_ptr.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / interprocess / include / boost / interprocess / smart_ptr / unique_ptr.hpp
CommitLineData
7c673cae
FG
1//////////////////////////////////////////////////////////////////////////////
2//
3// (C) Copyright Ion Gaztanaga 2006-2014. Distributed under the Boost
4// Software License, Version 1.0. (See accompanying file
5// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6//
7// See http://www.boost.org/libs/interprocess for documentation.
8//
9//////////////////////////////////////////////////////////////////////////////
10
11#ifndef BOOST_INTERPROCESS_UNIQUE_PTR_HPP_INCLUDED
12#define BOOST_INTERPROCESS_UNIQUE_PTR_HPP_INCLUDED
13
14#ifndef BOOST_CONFIG_HPP
15# include <boost/config.hpp>
16#endif
17#
18#if defined(BOOST_HAS_PRAGMA_ONCE)
19# pragma once
20#endif
21
22#include <boost/interprocess/detail/config_begin.hpp>
23#include <boost/interprocess/detail/workaround.hpp>
24#include <boost/move/unique_ptr.hpp>
25
26//!\file
27//!This header provides utilities to define a unique_ptr that plays nicely with managed segments.
28
29namespace boost{
30namespace interprocess{
31
32//For backwards compatibility
33using ::boost::movelib::unique_ptr;
34
35//!Returns the type of a unique pointer
36//!of type T with boost::interprocess::deleter deleter
37//!that can be constructed in the given managed segment type.
38template<class T, class ManagedMemory>
39struct managed_unique_ptr
40{
41 typedef boost::movelib::unique_ptr
42 < T
43 , typename ManagedMemory::template deleter<T>::type
44 > type;
45};
46
47//!Returns an instance of a unique pointer constructed
48//!with boost::interproces::deleter from a pointer
49//!of type T that has been allocated in the passed managed segment
50template<class T, class ManagedMemory>
51inline typename managed_unique_ptr<T, ManagedMemory>::type
52 make_managed_unique_ptr(T *constructed_object, ManagedMemory &managed_memory)
53{
54 return typename managed_unique_ptr<T, ManagedMemory>::type
55 (constructed_object, managed_memory.template get_deleter<T>());
56}
57
58} //namespace interprocess{
59} //namespace boost{
60
61#include <boost/interprocess/detail/config_end.hpp>
62
63#endif //#ifndef BOOST_INTERPROCESS_UNIQUE_PTR_HPP_INCLUDED