Chris@102: // local_free_on_exit.hpp ------------------------------------------------------------// Chris@102: Chris@102: // Copyright (c) 2003-2010 Christopher M. Kohlhoff (chris at kohlhoff dot com) Chris@102: // Copyright (c) 2010 Beman Dawes Chris@102: Chris@102: // Distributed under the Boost Software License, Version 1.0. Chris@102: // See http://www.boost.org/LICENSE_1_0.txt Chris@102: Chris@102: // This is derived from boost/asio/detail/local_free_on_block_exit.hpp to avoid Chris@102: // a dependency on asio. Thanks to Chris Kohlhoff for pointing it out. Chris@102: Chris@102: #ifndef BOOST_SYSTEM_LOCAL_FREE_ON_EXIT_HPP Chris@102: #define BOOST_SYSTEM_LOCAL_FREE_ON_EXIT_HPP Chris@102: Chris@102: namespace boost { Chris@102: namespace system { Chris@102: namespace detail { Chris@102: Chris@102: class local_free_on_destruction Chris@102: { Chris@102: public: Chris@102: explicit local_free_on_destruction(void* p) Chris@102: : p_(p) {} Chris@102: Chris@102: ~local_free_on_destruction() Chris@102: { Chris@102: ::LocalFree(p_); Chris@102: } Chris@102: Chris@102: private: Chris@102: void* p_; Chris@102: local_free_on_destruction(const local_free_on_destruction&); // = deleted Chris@102: local_free_on_destruction& operator=(const local_free_on_destruction&); // = deleted Chris@102: }; Chris@102: Chris@102: } // namespace detail Chris@102: } // namespace system Chris@102: } // namespace boost Chris@102: Chris@102: #endif // BOOST_SYSTEM_LOCAL_FREE_ON_EXIT_HPP