1 //////////////////////////////////////////////////////////////////////////////
3 // (C) Copyright Ion Gaztanaga 2007-2012.
5 // Distributed under the Boost Software License, Version 1.0.
6 // (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 // See http://www.boost.org/libs/interprocess for documentation.
11 //////////////////////////////////////////////////////////////////////////////
13 #ifndef BOOST_INTERPROCESS_DELETER_HPP
14 #define BOOST_INTERPROCESS_DELETER_HPP
16 #ifndef BOOST_CONFIG_HPP
17 # include <boost/config.hpp>
20 #if defined(BOOST_HAS_PRAGMA_ONCE)
24 #include <boost/interprocess/detail/config_begin.hpp>
25 #include <boost/interprocess/interprocess_fwd.hpp>
26 #include <boost/interprocess/detail/utilities.hpp>
27 #include <boost/intrusive/pointer_traits.hpp>
30 //!Describes the functor to delete objects from the segment.
33 namespace interprocess {
35 //!A deleter that uses the segment manager's destroy_ptr
36 //!function to destroy the passed pointer resource.
38 //!This deleter is used
39 template<class T, class SegmentManager>
43 typedef typename boost::intrusive::
44 pointer_traits<typename SegmentManager::void_pointer>::template
45 rebind_pointer<T>::type pointer;
48 typedef typename boost::intrusive::
49 pointer_traits<pointer>::template
50 rebind_pointer<SegmentManager>::type segment_manager_pointer;
52 segment_manager_pointer mp_mngr;
55 deleter(segment_manager_pointer pmngr)
59 void operator()(const pointer &p)
60 { mp_mngr->destroy_ptr(ipcdetail::to_raw_pointer(p)); }
63 } //namespace interprocess {
66 #include <boost/interprocess/detail/config_end.hpp>
68 #endif //#ifndef BOOST_INTERPROCESS_DELETER_HPP