2 * Copyright Andrey Semashev 2007 - 2015.
3 * Distributed under the Boost Software License, Version 1.0.
4 * (See accompanying file LICENSE_1_0.txt or copy at
5 * http://www.boost.org/LICENSE_1_0.txt)
8 * \file cleanup_scope_guard.hpp
9 * \author Andrey Semashev
12 * \brief This header is the Boost.Log library implementation, see the library documentation
13 * at http://www.boost.org/doc/libs/release/libs/log/doc/html/index.html.
16 #ifndef BOOST_LOG_DETAIL_CLEANUP_SCOPE_GUARD_HPP_INCLUDED_
17 #define BOOST_LOG_DETAIL_CLEANUP_SCOPE_GUARD_HPP_INCLUDED_
19 #include <boost/log/detail/config.hpp>
20 #include <boost/log/detail/header.hpp>
22 #ifdef BOOST_HAS_PRAGMA_ONCE
28 BOOST_LOG_OPEN_NAMESPACE
32 //! Cleanup scope guard
33 template< typename T >
36 explicit cleanup_guard(T& obj) : m_Obj(obj) {}
37 ~cleanup_guard() { m_Obj.clear(); }
40 BOOST_DELETED_FUNCTION(cleanup_guard(cleanup_guard const&))
41 BOOST_DELETED_FUNCTION(cleanup_guard& operator= (cleanup_guard const&))
49 BOOST_LOG_CLOSE_NAMESPACE // namespace log
53 #include <boost/log/detail/footer.hpp>
55 #endif // BOOST_LOG_DETAIL_CLEANUP_SCOPE_GUARD_HPP_INCLUDED_