1 /////////////////////////////////////////////////////////////////////////////
3 // (C) Copyright Ion Gaztanaga 2014-2014
5 // Distributed under the Boost Software License, Version 1.0.
6 // (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 // See http://www.boost.org/libs/intrusive for documentation.
11 /////////////////////////////////////////////////////////////////////////////
13 #ifndef BOOST_INTRUSIVE_DETAIL_EXCEPTION_DISPOSER_HPP
14 #define BOOST_INTRUSIVE_DETAIL_EXCEPTION_DISPOSER_HPP
16 #ifndef BOOST_CONFIG_HPP
17 # include <boost/config.hpp>
20 #if defined(BOOST_HAS_PRAGMA_ONCE)
24 #include <boost/intrusive/detail/workaround.hpp>
30 template<class Container, class Disposer>
31 class exception_disposer
36 exception_disposer(const exception_disposer&);
37 exception_disposer &operator=(const exception_disposer&);
40 exception_disposer(Container &cont, Disposer &disp)
41 : cont_(&cont), disp_(disp)
44 BOOST_INTRUSIVE_FORCEINLINE void release()
50 cont_->clear_and_dispose(disp_);
55 template<class Container, class Disposer, class SizeType>
56 class exception_array_disposer
60 SizeType &constructed_;
62 exception_array_disposer(const exception_array_disposer&);
63 exception_array_disposer &operator=(const exception_array_disposer&);
67 exception_array_disposer
68 (Container &cont, Disposer &disp, SizeType &constructed)
69 : cont_(&cont), disp_(disp), constructed_(constructed)
72 BOOST_INTRUSIVE_FORCEINLINE void release()
75 ~exception_array_disposer()
77 SizeType n = constructed_;
80 cont_[n].clear_and_dispose(disp_);
87 } //namespace intrusive{
90 #endif //BOOST_INTRUSIVE_DETAIL_EXCEPTION_DISPOSER_HPP