Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-26 08:51:18

0001 //////////////////////////////////////////////////////////////////////////////
0002 //
0003 // (C) Copyright Ion Gaztanaga 2015-2016.
0004 // Distributed under the Boost Software License, Version 1.0.
0005 // (See accompanying file LICENSE_1_0.txt or copy at
0006 // http://www.boost.org/LICENSE_1_0.txt)
0007 //
0008 // See http://www.boost.org/libs/move for documentation.
0009 //
0010 //////////////////////////////////////////////////////////////////////////////
0011 
0012 //! \file
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 ">#
0022 #if defined(BOOST_HAS_PRAGMA_ONCE)
0023 #  pragma once
0024 #endif
0025 
0026 #include <cstddef>
0027 
0028 namespace boost {
0029 namespace movelib{
0030 
0031 template<class T, class RandItUninit>
0032 class destruct_n
0033 {
0034    public:
0035    explicit destruct_n(RandItUninit raw)
0036       : m_ptr(raw), m_size()
0037    {}
0038 
0039    void incr()
0040    {
0041       ++m_size;
0042    }
0043 
0044    void incr(std::size_t n)
0045    {
0046       m_size += n;
0047    }
0048 
0049    void release()
0050    {
0051       m_size = 0u;
0052    }
0053 
0054    ~destruct_n()
0055    {
0056       while(m_size--){
0057          m_ptr[m_size].~T();
0058       }
0059    }
0060    private:
0061    RandItUninit m_ptr;
0062    std::size_t m_size;
0063 };
0064 
0065 }} //namespace boost {  namespace movelib{
0066 
0067 #endif //#ifndef BOOST_MOVE_DETAIL_DESTRUCT_N_HPP