]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/system/detail/local_free_on_destruction.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / system / detail / local_free_on_destruction.hpp
1 // local_free_on_exit.hpp ------------------------------------------------------------//
2
3 // Copyright (c) 2003-2010 Christopher M. Kohlhoff (chris at kohlhoff dot com)
4 // Copyright (c) 2010 Beman Dawes
5
6 // Distributed under the Boost Software License, Version 1.0.
7 // See http://www.boost.org/LICENSE_1_0.txt
8
9 // This is derived from boost/asio/detail/local_free_on_block_exit.hpp to avoid
10 // a dependency on asio. Thanks to Chris Kohlhoff for pointing it out.
11
12 #ifndef BOOST_SYSTEM_LOCAL_FREE_ON_EXIT_HPP
13 #define BOOST_SYSTEM_LOCAL_FREE_ON_EXIT_HPP
14
15 #include <boost/winapi/local_memory.hpp>
16
17 namespace boost {
18 namespace system {
19 namespace detail {
20
21 class local_free_on_destruction
22 {
23 public:
24 explicit local_free_on_destruction(void* p)
25 : p_(p) {}
26
27 ~local_free_on_destruction()
28 {
29 boost::winapi::LocalFree(p_);
30 }
31
32 private:
33 void* p_;
34 local_free_on_destruction(const local_free_on_destruction&); // = deleted
35 local_free_on_destruction& operator=(const local_free_on_destruction&); // = deleted
36 };
37
38 } // namespace detail
39 } // namespace system
40 } // namespace boost
41
42 #endif // BOOST_SYSTEM_LOCAL_FREE_ON_EXIT_HPP