Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/interprocess/smart_ptr/deleter.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children | c530137014c0 |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
1 ////////////////////////////////////////////////////////////////////////////// | |
2 // | |
3 // (C) Copyright Ion Gaztanaga 2007-2012. | |
4 // | |
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) | |
8 // | |
9 // See http://www.boost.org/libs/interprocess for documentation. | |
10 // | |
11 ////////////////////////////////////////////////////////////////////////////// | |
12 | |
13 #ifndef BOOST_INTERPROCESS_DELETER_HPP | |
14 #define BOOST_INTERPROCESS_DELETER_HPP | |
15 | |
16 #if (defined _MSC_VER) && (_MSC_VER >= 1200) | |
17 # pragma once | |
18 #endif | |
19 | |
20 #include <boost/interprocess/detail/config_begin.hpp> | |
21 #include <boost/interprocess/interprocess_fwd.hpp> | |
22 #include <boost/interprocess/detail/utilities.hpp> | |
23 #include <boost/intrusive/pointer_traits.hpp> | |
24 | |
25 //!\file | |
26 //!Describes the functor to delete objects from the segment. | |
27 | |
28 namespace boost { | |
29 namespace interprocess { | |
30 | |
31 //!A deleter that uses the segment manager's destroy_ptr | |
32 //!function to destroy the passed pointer resource. | |
33 //! | |
34 //!This deleter is used | |
35 template<class T, class SegmentManager> | |
36 class deleter | |
37 { | |
38 public: | |
39 typedef typename boost::intrusive:: | |
40 pointer_traits<typename SegmentManager::void_pointer>::template | |
41 rebind_pointer<T>::type pointer; | |
42 | |
43 private: | |
44 typedef typename boost::intrusive:: | |
45 pointer_traits<pointer>::template | |
46 rebind_pointer<SegmentManager>::type segment_manager_pointer; | |
47 | |
48 segment_manager_pointer mp_mngr; | |
49 | |
50 public: | |
51 deleter(segment_manager_pointer pmngr) | |
52 : mp_mngr(pmngr) | |
53 {} | |
54 | |
55 void operator()(const pointer &p) | |
56 { mp_mngr->destroy_ptr(ipcdetail::to_raw_pointer(p)); } | |
57 }; | |
58 | |
59 } //namespace interprocess { | |
60 } //namespace boost { | |
61 | |
62 #include <boost/interprocess/detail/config_end.hpp> | |
63 | |
64 #endif //#ifndef BOOST_INTERPROCESS_DELETER_HPP |