]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/include/boost/geometry/index/detail/rtree/node/scoped_deallocator.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / include / boost / geometry / index / detail / rtree / node / scoped_deallocator.hpp
CommitLineData
7c673cae
FG
1// Boost.Geometry Index
2//
3// R-tree scoped deallocator
4//
5// Copyright (c) 2011-2015 Adam Wulkiewicz, Lodz, Poland.
6//
7// Use, modification and distribution is subject to the Boost Software License,
8// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9// http://www.boost.org/LICENSE_1_0.txt)
10
11#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_SCOPED_DEALLOCATOR_HPP
12#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_SCOPED_DEALLOCATOR_HPP
13
14namespace boost { namespace geometry { namespace index {
15
16namespace detail { namespace rtree {
17
18template <typename Alloc>
19class scoped_deallocator
20{
21 scoped_deallocator(scoped_deallocator const&);
22 scoped_deallocator & operator=(scoped_deallocator const&);
23public:
24 typedef typename Alloc::pointer pointer;
25 inline scoped_deallocator(pointer p, Alloc & a)
26 : m_ptr(p), m_alloc(a)
27 {}
28 inline ~scoped_deallocator()
29 {
30 if ( m_ptr )
31 {
32 boost::container::allocator_traits<Alloc>::deallocate(m_alloc, m_ptr, 1);
33 }
34 }
35 inline void release()
36 {
37 m_ptr = 0;
38 }
39private:
40 pointer m_ptr;
41 Alloc & m_alloc;
42};
43
44}} // namespace detail::rtree
45
46}}} // namespace boost::geometry::index
47
48#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_SCOPED_DEALLOCATOR_HPP