File indexing completed on 2025-01-18 09:35:29
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_SCOPED_DEALLOCATOR_HPP
0016 #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_SCOPED_DEALLOCATOR_HPP
0017
0018 #include <boost/container/allocator_traits.hpp>
0019
0020 namespace boost { namespace geometry { namespace index {
0021
0022 namespace detail { namespace rtree {
0023
0024 template <typename Alloc>
0025 class scoped_deallocator
0026 {
0027 typedef boost::container::allocator_traits<Alloc> alloc_traits;
0028
0029 scoped_deallocator(scoped_deallocator const&);
0030 scoped_deallocator & operator=(scoped_deallocator const&);
0031 public:
0032 typedef typename alloc_traits::pointer pointer;
0033
0034 inline scoped_deallocator(pointer p, Alloc & a)
0035 : m_ptr(p), m_alloc(a)
0036 {}
0037 inline ~scoped_deallocator()
0038 {
0039 if ( m_ptr )
0040 {
0041 alloc_traits::deallocate(m_alloc, m_ptr, 1);
0042 }
0043 }
0044 inline void release()
0045 {
0046 m_ptr = 0;
0047 }
0048 private:
0049 pointer m_ptr;
0050 Alloc & m_alloc;
0051 };
0052
0053 }}
0054
0055 }}}
0056
0057 #endif