2 * Copyright Andrey Semashev 2007 - 2014.
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 null_deleter.hpp
9 * \author Andrey Semashev
12 * This header contains a \c null_deleter implementation. This is an empty
13 * function object that receives a pointer and does nothing with it.
14 * Such empty deletion strategy may be convenient, for example, when
15 * constructing <tt>shared_ptr</tt>s that point to some object that should not be
16 * deleted (i.e. a variable on the stack or some global singleton, like <tt>std::cout</tt>).
19 #ifndef BOOST_CORE_NULL_DELETER_HPP
20 #define BOOST_CORE_NULL_DELETER_HPP
22 #include <boost/config.hpp>
24 #ifdef BOOST_HAS_PRAGMA_ONCE
30 //! A function object that does nothing and can be used as an empty deleter for \c shared_ptr
33 //! Function object result type
34 typedef void result_type;
38 template< typename T >
39 void operator() (T*) const BOOST_NOEXCEPT {}
44 #endif // BOOST_CORE_NULL_DELETER_HPP