File indexing completed on 2025-01-18 09:40:52
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef BOOST_MOVE_DETAIL_DESTRUCT_N_HPP
0015 #define BOOST_MOVE_DETAIL_DESTRUCT_N_HPP
0016
0017 #ifndef BOOST_CONFIG_HPP
0018 # include <boost/config.hpp>
0019 #endif
0020 #
0021 #if defined(BOOST_HAS_PRAGMA_ONCE)
0022 # pragma once
0023 #endif
0024
0025 #include <cstddef>
0026
0027 namespace boost {
0028 namespace movelib{
0029
0030 template<class T, class RandItUninit>
0031 class destruct_n
0032 {
0033 public:
0034 explicit destruct_n(RandItUninit raw)
0035 : m_ptr(raw), m_size()
0036 {}
0037
0038 void incr()
0039 {
0040 ++m_size;
0041 }
0042
0043 void incr(std::size_t n)
0044 {
0045 m_size += n;
0046 }
0047
0048 void release()
0049 {
0050 m_size = 0u;
0051 }
0052
0053 ~destruct_n()
0054 {
0055 while(m_size--){
0056 m_ptr[m_size].~T();
0057 }
0058 }
0059 private:
0060 RandItUninit m_ptr;
0061 std::size_t m_size;
0062 };
0063
0064 }}
0065
0066 #endif