Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:53:29

0001 //////////////////////////////////////////////////////////////////////////////
0002 //
0003 // (C) Copyright Ion Gaztanaga 2006-2014. Distributed under the Boost
0004 // Software License, Version 1.0. (See accompanying file
0005 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 // See http://www.boost.org/libs/interprocess for documentation.
0008 //
0009 //////////////////////////////////////////////////////////////////////////////
0010 
0011 #ifndef BOOST_INTERPROCESS_UNIQUE_PTR_HPP_INCLUDED
0012 #define BOOST_INTERPROCESS_UNIQUE_PTR_HPP_INCLUDED
0013 
0014 #ifndef BOOST_CONFIG_HPP
0015 #  include <boost/config.hpp>
0016 #endif
0017 #
0018 #if defined(BOOST_HAS_PRAGMA_ONCE)
0019 #  pragma once
0020 #endif
0021 
0022 #include <boost/interprocess/detail/config_begin.hpp>
0023 #include <boost/interprocess/detail/workaround.hpp>
0024 #include <boost/move/unique_ptr.hpp>
0025 
0026 //!\file
0027 //!This header provides utilities to define a unique_ptr that plays nicely with managed segments.
0028 
0029 namespace boost{
0030 namespace interprocess{
0031 
0032 //For backwards compatibility
0033 using ::boost::movelib::unique_ptr;
0034 
0035 //!Returns the type of a unique pointer
0036 //!of type T with boost::interprocess::deleter deleter
0037 //!that can be constructed in the given managed segment type.
0038 template<class T, class ManagedMemory>
0039 struct managed_unique_ptr
0040 {
0041    typedef boost::movelib::unique_ptr
0042    < T
0043    , typename ManagedMemory::template deleter<T>::type
0044    > type;
0045 };
0046 
0047 //!Returns an instance of a unique pointer constructed
0048 //!with boost::interproces::deleter from a pointer
0049 //!of type T that has been allocated in the passed managed segment
0050 template<class T, class ManagedMemory>
0051 inline typename managed_unique_ptr<T, ManagedMemory>::type
0052    make_managed_unique_ptr(T *constructed_object, ManagedMemory &managed_memory)
0053 {
0054    return typename managed_unique_ptr<T, ManagedMemory>::type
0055       (constructed_object, managed_memory.template get_deleter<T>());
0056 }
0057 
0058 }  //namespace interprocess{
0059 }  //namespace boost{
0060 
0061 #include <boost/interprocess/detail/config_end.hpp>
0062 
0063 #endif   //#ifndef BOOST_INTERPROCESS_UNIQUE_PTR_HPP_INCLUDED